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 # https://en.wikipedia.org/wiki/Percent-encoding $Release = (Get-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Raw).replace("%", "%25").replace("`n", "%0A").replace("`r", "%0D").replace("NewVersion", "${{ github.ref_name }}").replace("OldVersion", $Penultimate) # https://trstringer.com/github-actions-multiline-strings/ echo "::set-output name=RELEASE_BODY::$Release" $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: ${{ steps.read_release.outputs.RELEASE_BODY }}