Skip to content

Release Stable Binary's #51

Release Stable Binary's

Release Stable Binary's #51

name: Release Stable Binary's
on:
workflow_dispatch:
permissions:
contents: write
packages: write
env:
CARGO_TERM_COLOR: always
jobs:
app_version:
name: Get App Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from Cargo.toml
id: get_version
run: |
version=$(grep '^version' Cargo.toml | head -n1 | sed -E 's/version = "(.*)"/\1/')
echo "version=$version" >> $GITHUB_OUTPUT
linux_amd64_binary:
name: Prepare Linux AMD64 Binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Docker DinD
uses: docker/setup-buildx-action@v3
- name: Install Rust Cross Lib
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Build with Cross
run: |
cross build --target x86_64-unknown-linux-gnu --release -p phlow-runtime
- name: Upload Linux binary artifact
uses: actions/upload-artifact@v4
with:
name: phlow-binary-linux-amd64
path: ./target/x86_64-unknown-linux-gnu/release/phlow
linux_arm64_binary:
name: Prepare Linux ARM64 Binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Docker DinD
uses: docker/setup-buildx-action@v3
- name: Install Rust Cross Lib
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Build with Cross
run: |
cross build --target aarch64-unknown-linux-gnu --release -p phlow-runtime
- name: Upload Linux binary artifact
uses: actions/upload-artifact@v4
with:
name: phlow-binary-linux-arm64
path: ./target/aarch64-unknown-linux-gnu/release/phlow
build_macos:
name: Build Binary for macOS
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build with Cargo
run: cargo build --release
- name: Upload macOS binary
uses: actions/upload-artifact@v4
with:
name: phlow-binary-macos
path: target/release/phlow
tag:
name: Tag Release
runs-on: ubuntu-latest
needs:
- app_version
- linux_amd64_binary
- linux_arm64_binary
- build_macos
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Git Tag
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git fetch --tags
git tag "v${{ needs.app_version.outputs.version }}"
git push origin "v${{ needs.app_version.outputs.version }}"
github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs:
- app_version
- linux_amd64_binary
- linux_arm64_binary
- build_macos
- tag
steps:
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: phlow-binary-linux-amd64
path: ./linux-amd64
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: phlow-binary-linux-arm64
path: ./linux-arm64
- name: Download macOS binary
uses: actions/download-artifact@v4
with:
name: phlow-binary-macos
path: ./macos
- name: Rename binaries
run: |
mv ./linux-amd64/phlow ./linux-amd64/phlow-amd64
mv ./linux-arm64/phlow ./linux-arm64/phlow-arm64
mv ./macos/phlow ./macos/phlow-macos
- name: Upload binaries to GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.app_version.outputs.version }}
name: Release v${{ needs.app_version.outputs.version }}
files: |
./linux-amd64/phlow-amd64
./linux-arm64/phlow-arm64
./macos/phlow-macos
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}