ci(publish): reorder artifact upload and 7z packing steps #56
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: publish | |
| env: | |
| ProjectName: KeyAsio.Net | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build and Release | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Restore dependencies | |
| run: | | |
| dotnet restore src/Apps/KeyAsio -r win-x64 | |
| - name: Secrets | |
| shell: pwsh | |
| env: | |
| OFFICIAL_PUBLIC_KEY: ${{ secrets.OFFICIAL_PUBLIC_KEY }} | |
| OFFICIAL_PRIVATE_KEY: ${{ secrets.OFFICIAL_PRIVATE_KEY }} | |
| run: | | |
| $secretsContent = 'public partial class Secrets { internal static readonly string Dsn ="${{ secrets.SENTRY_DSN }}"; internal static readonly string OfficialPublicKey = @"' + $env:OFFICIAL_PUBLIC_KEY + '"; }' | |
| Set-Content -Path "src/Common/KeyAsio.Secrets/Secrets.cs" -Value $secretsContent | |
| if ($env:OFFICIAL_PRIVATE_KEY) { | |
| Set-Content -Path "src/Apps/KeyAsio/keyasio_private.key" -Value $env:OFFICIAL_PRIVATE_KEY | |
| } | |
| - name: Publish | |
| run: | | |
| echo ${{ github.ref }} | |
| dotnet publish src/Apps/KeyAsio --no-restore --framework net10.0 --runtime win-x64 --self-contained --configuration Release --output ci-publish-win64 | |
| - name: Confuser | |
| shell: pwsh | |
| run: | | |
| echo '<project outputDir="." baseDir=".\ci-publish-win64" xmlns="http://confuser.codeplex.com"><rule pattern="true" preset="maximum" inherit="false" /><module path="KeyAsio.Secrets.dll" /></project>'>confuse64.crproj | |
| mkdir Confuser -Force | |
| Invoke-WebRequest ${{ secrets.CONFUSER_DLURL }} -OutFile "Confuser/cli.zip" | |
| 7z x "Confuser/cli.zip" -oConfuser/ | |
| .\Confuser\${{ secrets.CONFUSER_EXE }} -file ".\ci-publish-win64\KeyAsio.Secrets.dll" -targetfile "<AssemblyLocation>\<AssemblyFileName>" -anti_debug 1 -hide_calls 1 -control_flow 1 -flow_level 9 -virtualization 1 -naming stealth | |
| del .\ci-publish-win64\KeyAsio.Secrets.pdb -Force | |
| - name: Set dll path | |
| shell: pwsh | |
| run: | | |
| copy .\src\Apps\KeyAsio\DotNetDllPathPatcher.ps1 .\DotNetDllPathPatcher.ps1 | |
| .\src\Apps\KeyAsio\afterbuild.ps1 .\ci-publish-win64\KeyASIO.exe | |
| - name: Upload Artifacts | |
| if: contains(github.ref_name, 'alpha') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ProjectName }}-${{ github.ref_name }} | |
| path: ./ci-publish-win64/* | |
| - name: Pack via 7z | |
| if: ${{ !contains(github.ref_name, 'alpha') }} | |
| run: | | |
| mkdir -p ./ci-pack/ | |
| 7z a -mx9 -mfb=273 -ms -md=31 -myx=9 -mtm=- -mmt -mmtf -md=1536m -mmf=bt3 -mmc=10000 -mpb=0 -mlc=0 "./ci-pack/${{ env.ProjectName }}-${{ github.ref_name }}-win64.7z" "./ci-publish-win64/*" -x!"${{ env.ProjectName }}" -r | |
| - name: Create a new GitHub release if a new tag is pushed | |
| if: ${{ !contains(github.ref_name, 'alpha') }} | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
| with: | |
| body: | | |
| [Forum page](https://osu.ppy.sh/community/forums/topics/1602658) | |
| ## Release notes | |
| 1. Place holder | |
| name: ${{ env.ProjectName }}-${{ github.ref_name }} | |
| prerelease: true | |
| draft: false | |
| files: | | |
| ./ci-pack/${{ env.ProjectName }}-${{ github.ref_name }}-win64.7z |