.NET CD - Release #1
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: .NET CD - Release | |
| # This workflow runs manually or when a new release is created | |
| on: | |
| workflow_dispatch: # Allows manual triggering | |
| release: | |
| types: [created] | |
| jobs: | |
| build-release: | |
| name: Build Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release | |
| # Create binaries for multiple platforms | |
| - name: Publish for Windows | |
| run: dotnet publish BCFileDecryptor/BCFileDecryptor.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -o publish/win-x64 | |
| - name: Publish for Linux | |
| run: dotnet publish BCFileDecryptor/BCFileDecryptor.csproj -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -o publish/linux-x64 | |
| - name: Publish for macOS | |
| run: dotnet publish BCFileDecryptor/BCFileDecryptor.csproj -c Release -r osx-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -o publish/osx-x64 | |
| # Upload raw build output for the packaging job | |
| - name: Upload Windows build output | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: windows-build-output | |
| path: publish/win-x64/ | |
| retention-days: 1 | |
| - name: Upload Linux build output | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: linux-build-output | |
| path: publish/linux-x64/ | |
| retention-days: 1 | |
| - name: Upload macOS build output | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: macos-build-output | |
| path: publish/osx-x64/ | |
| retention-days: 1 | |
| package: | |
| name: Package and Publish | |
| needs: build-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| # Download build outputs from the build job | |
| - name: Download Windows build | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: windows-build-output | |
| path: publish/win-x64/ | |
| - name: Download Linux build | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: linux-build-output | |
| path: publish/linux-x64/ | |
| - name: Download macOS build | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: macos-build-output | |
| path: publish/osx-x64/ | |
| # Create zip archives for each platform | |
| - name: Zip Windows build | |
| run: cd publish/win-x64 && zip -r ../../BCFileDecryptor-windows.zip * | |
| - name: Zip Linux build | |
| run: cd publish/linux-x64 && zip -r ../../BCFileDecryptor-linux.zip * | |
| - name: Zip macOS build | |
| run: cd publish/osx-x64 && zip -r ../../BCFileDecryptor-macos.zip * | |
| # Upload artifacts for download from the Actions tab | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: BCFileDecryptor-windows | |
| path: BCFileDecryptor-windows.zip | |
| retention-days: 30 | |
| - name: Upload Linux artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: BCFileDecryptor-linux | |
| path: BCFileDecryptor-linux.zip | |
| retention-days: 30 | |
| - name: Upload macOS artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: BCFileDecryptor-macos | |
| path: BCFileDecryptor-macos.zip | |
| retention-days: 30 | |
| # If this was triggered by a release, attach the binaries to the release | |
| - name: Upload binaries to release | |
| if: github.event_name == 'release' | |
| uses: AButler/upload-release-assets@ec6d3263266dc57eb6645b5f75e827987f7c217d # v2.0 | |
| with: | |
| files: 'BCFileDecryptor-*.zip' | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} |