chore: release v0.3.0 (version, changelog, readme, cursor rules) #5
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: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: "Release tag to publish (for example: v0.2.0)" | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os_name }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os_name: linux-x86_64 | |
| runner: ubuntu-latest | |
| archive_name: linux-x86_64 | |
| archive_ext: tar.gz | |
| binary_name: cortex | |
| rust_target: x86_64-unknown-linux-gnu | |
| - os_name: windows-x86_64 | |
| runner: windows-latest | |
| archive_name: windows-x86_64 | |
| archive_ext: zip | |
| binary_name: cortex.exe | |
| rust_target: x86_64-pc-windows-msvc | |
| - os_name: macos-aarch64 | |
| runner: macos-14 | |
| archive_name: macos-aarch64 | |
| archive_ext: tar.gz | |
| binary_name: cortex | |
| rust_target: aarch64-apple-darwin | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Resolve release tag | |
| shell: pwsh | |
| run: | | |
| if ("${{ github.event_name }}" -eq "workflow_dispatch") { | |
| $tag = "${{ github.event.inputs.release_tag }}" | |
| } else { | |
| $tag = "${{ github.ref_name }}" | |
| } | |
| "RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.rust_target }} | |
| - name: Restore Cargo cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: daemon-rs -> daemon-rs/target | |
| - name: Build release binary | |
| working-directory: daemon-rs | |
| run: cargo build --release --target ${{ matrix.rust_target }} | |
| - name: Package Unix archive | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ARCHIVE="cortex-${RELEASE_TAG}-${{ matrix.archive_name }}.${{ matrix.archive_ext }}" | |
| tar -czf "${ARCHIVE}" -C "daemon-rs/target/${{ matrix.rust_target }}/release" "${{ matrix.binary_name }}" | |
| echo "ARCHIVE=${ARCHIVE}" >> "${GITHUB_ENV}" | |
| - name: Package Windows archive | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $archive = "cortex-$env:RELEASE_TAG-${{ matrix.archive_name }}.${{ matrix.archive_ext }}" | |
| Compress-Archive -Path "daemon-rs/target/${{ matrix.rust_target }}/release/${{ matrix.binary_name }}" -DestinationPath $archive -Force | |
| "ARCHIVE=$archive" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
| - name: Upload archive artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ARCHIVE }} | |
| path: ${{ env.ARCHIVE }} | |
| if-no-files-found: error | |
| release: | |
| name: Publish GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Resolve release tag | |
| shell: pwsh | |
| run: | | |
| if ("${{ github.event_name }}" -eq "workflow_dispatch") { | |
| $tag = "${{ github.event.inputs.release_tag }}" | |
| } else { | |
| $tag = "${{ github.ref_name }}" | |
| } | |
| "RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.RELEASE_TAG }} | |
| files: | | |
| dist/cortex-${{ env.RELEASE_TAG }}-windows-x86_64.zip | |
| dist/cortex-${{ env.RELEASE_TAG }}-macos-aarch64.tar.gz | |
| dist/cortex-${{ env.RELEASE_TAG }}-linux-x86_64.tar.gz | |
| generate_release_notes: true | |
| fail_on_unmatched_files: true |