Release v0.0.2 #1
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: Release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-tag: | |
| name: Create Tag | |
| runs-on: ubuntu-latest | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')) | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract version from Directory.Build.props | |
| id: version | |
| run: | | |
| version=$(grep -oP '<Version>\K\d+\.\d+\.\d+' Directory.Build.props) | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Delete existing release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release delete "v${{ steps.version.outputs.version }}" \ | |
| --repo "${{ github.repository }}" --yes || true | |
| - name: Delete existing tag | |
| run: | | |
| git push origin --delete "v${{ steps.version.outputs.version }}" || true | |
| - name: Create tag | |
| run: | | |
| git tag "v${{ steps.version.outputs.version }}" | |
| git push origin "v${{ steps.version.outputs.version }}" | |
| build: | |
| name: Build Native AOT (${{ matrix.rid }}) | |
| needs: create-tag | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - rid: win-x64 | |
| os: windows-latest | |
| ext: .exe | |
| - rid: win-arm64 | |
| os: windows-latest | |
| ext: .exe | |
| - rid: linux-x64 | |
| os: ubuntu-latest | |
| ext: "" | |
| - rid: osx-arm64 | |
| os: macos-latest | |
| ext: "" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.x' | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Publish (Native AOT) | |
| run: > | |
| dotnet publish src/PapersCli.Cli/PapersCli.Cli.csproj | |
| --configuration Release | |
| --runtime ${{ matrix.rid }} | |
| --output publish/ | |
| - name: Rename binary (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| mv publish/papers-cli.exe "publish/papers-cli-${{ matrix.rid }}.exe" | |
| - name: Rename binary (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| mv publish/papers-cli "publish/papers-cli-${{ matrix.rid }}" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: papers-cli-${{ matrix.rid }} | |
| path: publish/papers-cli-${{ matrix.rid }}${{ matrix.ext }} | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [create-tag, build] | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| merge-multiple: true | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "v${{ needs.create-tag.outputs.version }}" \ | |
| artifacts/papers-cli-win-x64.exe \ | |
| artifacts/papers-cli-win-arm64.exe \ | |
| artifacts/papers-cli-linux-x64 \ | |
| artifacts/papers-cli-osx-arm64 \ | |
| --repo "${{ github.repository }}" \ | |
| --title "v${{ needs.create-tag.outputs.version }}" \ | |
| --generate-notes |