release/glint: Add to bazel bins #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: Build Glint | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'rust/glint/**' | |
| - '.github/workflows/glint.yml' | |
| pull_request: | |
| paths: | |
| - 'rust/glint/**' | |
| - '.github/workflows/glint.yml' | |
| release: | |
| types: | |
| released | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| runs-on: ubuntu-24.04 | |
| rust-target: x86_64-unknown-linux-gnu | |
| - arch: aarch64 | |
| runs-on: ubuntu-24.04-arm | |
| rust-target: aarch64-unknown-linux-gnu | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: Run tests | |
| run: cargo test | |
| working-directory: rust/glint | |
| - name: Build glint | |
| run: cargo build --release | |
| working-directory: rust/glint | |
| - name: Get glint version | |
| id: version | |
| run: | | |
| VERSION=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| working-directory: rust/glint | |
| - name: Strip binary | |
| run: strip target/release/glint | |
| working-directory: rust/glint | |
| - name: Package glint | |
| run: | | |
| mkdir -p glint-${{ steps.version.outputs.version }}-${{ matrix.arch }} | |
| cp rust/glint/target/release/glint glint-${{ steps.version.outputs.version }}-${{ matrix.arch }}/ | |
| tar -cJf glint-${{ steps.version.outputs.version }}-${{ matrix.arch }}.tar.xz \ | |
| glint-${{ steps.version.outputs.version }}-${{ matrix.arch }} | |
| - name: Upload glint binary | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: glint-${{ steps.version.outputs.version }}-${{ matrix.arch }} | |
| path: glint-${{ steps.version.outputs.version }}-${{ matrix.arch }}.tar.xz | |
| retention-days: 30 | |
| publish: | |
| if: github.event_name == 'release' && startsWith(github.event.release.name, 'bazel-bins') | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - build | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Download all workflow run artifacts | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| with: | |
| path: artifacts | |
| - name: Upload release assets | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| for artifact in artifacts/*; do | |
| [[ ! -d "$artifact" ]] && continue | |
| name=$(basename "$artifact") | |
| file=$(ls "$artifact"/*.tar.xz) | |
| echo "Uploading $file as $name.tar.xz" | |
| gh release upload "${{ github.event.release.tag_name }}" \ | |
| "$file#$name.tar.xz" \ | |
| --clobber | |
| done |