name: Release on: workflow_dispatch: jobs: get-tag: runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} steps: - name: Checkout uses: actions/checkout@v4 - name: Get current tag id: tag run: | TAG=v$(head -n 4 Cargo.toml | grep version | awk '{print $3}' | tr -d '"') echo "Current tag: $TAG" echo "tag=$TAG" >> $GITHUB_OUTPUT build-binaries: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Rust uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Install cross run: RUSTFLAGS="" cargo install cross --git https://github.com/cross-rs/cross - name: Set up Bun uses: oven-sh/setup-bun@v2 - name: Install deps run: cd web && bun install - name: Build amd64 binary run: | ./build.sh cross build --target x86_64-unknown-linux-musl --release mv target/x86_64-unknown-linux-musl/release/cup ./cup-linux-amd64 - name: Build arm64 binary run: | ./build.sh cross build --target aarch64-unknown-linux-musl --release mv target/aarch64-unknown-linux-musl/release/cup ./cup-linux-arm64 - name: Upload binaries uses: actions/upload-artifact@v4 with: name: binaries path: | cup-linux-amd64 cup-linux-arm64 build-image: needs: - get-tag - build-binaries runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - uses: ./.github/actions/build-image with: tags: | ${{ needs.get-tag.outputs.tag }} latest gh-token: ${{ secrets.GITHUB_TOKEN }} release: runs-on: ubuntu-latest needs: [get-tag, build-image, build-binaries] steps: - name: Download binaries uses: actions/download-artifact@v4 with: name: binaries path: binaries - name: Create release uses: softprops/action-gh-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: prerelease: true tag_name: ${{ needs.get-tag.outputs.tag }} name: ${{ needs.get-tag.outputs.tag }} files: binaries/*