Skip to content

Commit

Permalink
Build linux binaries in publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
tjk committed Nov 26, 2024
1 parent 9e758aa commit fcb2aa3
Showing 1 changed file with 99 additions and 8 deletions.
107 changes: 99 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ jobs:
exit 1
fi
- name: Build release binaries
run: |
cargo build --release
mkdir -p release-artifacts
cp target/release/termv release-artifacts/termv-${{ github.ref_name }}-linux-x86_64
- name: Publish to crates.io
if: github.event_name == 'push'
run: cargo publish
Expand All @@ -53,12 +47,11 @@ jobs:
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: |
release-artifacts/*

build-macos:
name: Build macOS binary
runs-on: macos-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -73,10 +66,16 @@ jobs:
with:
name: macos-binary
path: release-artifacts/*
- name: Upload to release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
files: release-artifacts/*

build-windows:
name: Build Windows binary
runs-on: windows-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -91,3 +90,95 @@ jobs:
with:
name: windows-binary
path: release-artifacts\*
- name: Upload to release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
files: release-artifacts\*

build-linux-arm64:
name: Build Linux ARM64 binary
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
- name: Install cross-compilation dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build release binary
run: |
cargo build --release --target aarch64-unknown-linux-gnu
mkdir -p release-artifacts
cp target/aarch64-unknown-linux-gnu/release/termv release-artifacts/termv-${{ github.ref_name }}-linux-arm64
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-arm64-binary
path: release-artifacts/*
- name: Upload to release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
files: release-artifacts/*

build-linux-x86:
name: Build Linux x86 (32-bit) binary
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: i686-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
- name: Install cross-compilation dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib
- name: Build release binary
run: |
cargo build --release --target i686-unknown-linux-gnu
mkdir -p release-artifacts
cp target/i686-unknown-linux-gnu/release/termv release-artifacts/termv-${{ github.ref_name }}-linux-x86
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-x86-binary
path: release-artifacts/*
- name: Upload to release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
files: release-artifacts/*

build-linux-x86_64:
name: Build Linux x86_64 (64-bit) binary
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- uses: Swatinem/rust-cache@v2
- name: Build release binary
run: |
cargo build --release --target x86_64-unknown-linux-gnu
mkdir -p release-artifacts
cp target/x86_64-unknown-linux-gnu/release/termv release-artifacts/termv-${{ github.ref_name }}-linux-x86_64
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-x86_64-binary
path: release-artifacts/*
- name: Upload to release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
files: release-artifacts/*

0 comments on commit fcb2aa3

Please sign in to comment.