Release #6
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: | |
| tag: | |
| description: 'Tag to release' | |
| required: true | |
| default: 'v0.1.0' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux x86_64 | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| # macOS x86_64 (Intel) | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| # macOS ARM64 (Apple Silicon) | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-registry- | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-git- | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo-build- | |
| - name: Build binaries | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} --bin tart-backend | |
| cargo build --release --target ${{ matrix.target }} --features dashboard --bin tart-dash | |
| - name: Strip binaries | |
| run: | | |
| strip target/${{ matrix.target }}/release/tart-backend || true | |
| strip target/${{ matrix.target }}/release/tart-dash || true | |
| - name: Rename binaries with target suffix | |
| run: | | |
| cp target/${{ matrix.target }}/release/tart-backend tart-backend-${{ matrix.target }} | |
| cp target/${{ matrix.target }}/release/tart-dash tart-dash-${{ matrix.target }} | |
| - name: Upload backend artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tart-backend-${{ matrix.target }} | |
| path: tart-backend-${{ matrix.target }} | |
| if-no-files-found: error | |
| - name: Upload dashboard artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tart-dash-${{ matrix.target }} | |
| path: tart-dash-${{ matrix.target }} | |
| if-no-files-found: error | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -R artifacts | |
| - name: Get tag name | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Generate checksums | |
| run: | | |
| cd artifacts | |
| sha256sum * > SHA256SUMS | |
| cat SHA256SUMS | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.TAG }} | |
| name: Release ${{ steps.tag.outputs.TAG }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| artifacts/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |