name: Build on: push: tags: - "*.*" jobs: patch: runs-on: windows-latest timeout-minutes: 5 steps: - uses: actions/checkout@main - name: Signing all .ps1, .psm1, .psd1 files run: | . Scripts\Sign.ps1 - name: Dependencies run: | . "Scripts\Dependencies.ps1" - name: Sophia Script for Windows 10 run: | . "Scripts\Windows_10.ps1" - name: Sophia Script for Windows 10 PowerShell 7 run: | . "Scripts\Windows_10_PS_7.ps1" - name: Sophia Script for Windows 10 LTSC 2019 run: | . "Scripts\Windows_10_LTSC_2019.ps1" - name: Sophia Script for Windows 10 LTSC 2021 run: | . "Scripts\Windows_10_LTSC_2021.ps1" - name: Sophia Script for Windows 11 run: | . "Scripts\Windows_11.ps1" - name: Sophia Script for Windows 11 PowerShell 7 run: | . "Scripts\Windows_11_PS_7.ps1" - name: Sophia Script Wrapper run: | . "Scripts\Wrapper.ps1" - name: ReleaseNotesTemplate id: read_release run: | # Get a penultimate build tag $Token = "${{ secrets.GITHUB_TOKEN }}" $Headers = @{ Accept = "application/json" Authorization = "Bearer $Token" } $Parameters = @{ Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases" Headers = $Headers UseBasicParsing = $true Verbose = $true } $Penultimate = (Invoke-RestMethod @Parameters).tag_name | Select-Object -Index 1 # No need to replace special characters with percent-encoding ones (Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("NewVersion", "${{ github.ref_name }}").replace("OldVersion", $Penultimate) | Set-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Force # https://trstringer.com/github-actions-multiline-strings/ Add-Content -Path $env:GITHUB_OUTPUT -Value "ReleaseBody=ReleaseNotesTemplate.md" $ReleaseName = Get-Date -f "dd.MM.yyyy" echo "RELEASE_NAME=$ReleaseName" >> $env:GITHUB_ENV - name: Uploading uses: softprops/action-gh-release@master with: name: ${{ env.RELEASE_NAME }} token: ${{ github.token }} files: | Sophia*.zip SHA256SUM body_path: ${{ steps.read_release.outputs.ReleaseBody }}