Refactor build process to update Linux binary paths #58
This file contains 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, Publish Docker Image, and Release Binaries | |
on: | |
push: | |
branches: | |
- release | |
jobs: | |
build-and-release-binaries: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: Extract version from Cargo.toml | |
id: extract_version | |
run: | | |
VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
# - name: Build Linux binary x86_64-gnu | |
# run: | | |
# cross build --target x86_64-unknown-linux-gnu --release | |
# mkdir -p build/linux-gnu/ | |
# cp target/x86_64-unknown-linux-gnu/release/easy-proxy build/linux-gnu/ | |
# - name: Build Linux binary x86_64-musl | |
# run: | | |
# cross build --target x86_64-unknown-linux-musl --release | |
# mkdir -p build/linux-musl/ | |
# cp target/x86_64-unknown-linux-musl/release/easy-proxy build/linux-musl/ | |
- name: Build Linux binary aarch64-gnu | |
run: | | |
cross build --target aarch64-unknown-linux-gnu --release | |
mkdir -p build/linux/ | |
cp target/aarch64-unknown-linux-gnu/release/easy-proxy build/linux/aarch64-easy-proxy-linux-gnu | |
# - name: Build Linux binary aarch64-musl | |
# run: | | |
# cross build --target aarch64-unknown-linux-musl --release | |
# mkdir -p build/linux-musl/ | |
# cp target/aarch64-unknown-linux-musl/release/easy-proxy build/linux-musl/ | |
- name: Push binaries to release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
build/linux/aarch64-easy-proxy-linux-gnu | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: v${{ steps.extract_version.outputs.version }} | |
name: v${{ steps.extract_version.outputs.version }} |