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 to prod | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| env: | ||
| APP_NAME: Resolver | ||
| BRANCH_NAME: production | ||
| jobs: | ||
| build: | ||
| # Enforce branch restriction | ||
| if: github.ref_name == '${{ env.BRANCH_NAME }}' | ||
| name: Build ${{ matrix.os }}-${{ matrix.arch }} | ||
| runs-on: ${{ matrix.runner }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: linux | ||
| arch: x64 | ||
| runner: ubuntu-latest | ||
| rid: linux-x64 | ||
| - os: linux | ||
| arch: arm64 | ||
| runner: ubuntu-24.04-arm | ||
| rid: linux-arm64 | ||
| - os: macos | ||
| arch: x64 | ||
| runner: macos-15-intel | ||
| rid: osx-x64 | ||
| - os: macos | ||
| arch: arm64 | ||
| runner: macos-latest | ||
| rid: osx-arm64 | ||
| - os: windows | ||
| arch: x64 | ||
| runner: windows-latest | ||
| rid: win-x64 | ||
| - os: windows | ||
| arch: arm64 | ||
| runner: windows-11-arm | ||
| rid: win-arm64 | ||
| steps: | ||
| - name: Checkout git repo | ||
| uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
| - name: Publish (Unix) | ||
| if: matrix.os != 'windows' | ||
| run: | | ||
| dotnet publish src/${{ env.APP_NAME }}/${{ env.APP_NAME }}.csproj \ | ||
| -c Release \ | ||
| -r ${{ matrix.rid }} \ | ||
| -o ./publish | ||
| - name: Publish (Windows) | ||
| if: matrix.os == 'windows' | ||
| shell: pwsh | ||
| run: | | ||
| dotnet publish src/${{ env.APP_NAME }}/${{ env.APP_NAME }}.csproj ` | ||
| -c Release ` | ||
| -r ${{ matrix.rid }} ` | ||
| -o ./publish | ||
| - name: Rename binary (Unix) | ||
| if: matrix.os != 'windows' | ||
| run: | | ||
| cd publish | ||
| mv ${{ env.APP_NAME }} ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }} | ||
| - name: Rename binary (Windows) | ||
| if: matrix.os == 'windows' | ||
| shell: pwsh | ||
| run: | | ||
| cd publish | ||
| Move-Item ${{ env.APP_NAME }}.exe ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.exe | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }} | ||
| path: publish/${{ env.APP_NAME }}-* | ||
| release: | ||
| name: Create Release | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: artifacts | ||
| - name: Generate SHA256 checksums | ||
| run: | | ||
| cd artifacts | ||
| find . -type f ! -name 'checksums.sha256' -exec sha256sum {} \; > checksums.sha256 | ||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| tag_name: ${{ github.ref_name }} | ||
| files: artifacts/**/* | ||
| generate_release_notes: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||