Release Binaries #20
Workflow file for this run
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: Release Binaries | |
"on": | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build-release: | |
name: Build ${{ matrix.artifact_name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
artifact_name: rustygate-linux-amd64 | |
sha_cmd: sha256sum | |
container: alpine:3.19 | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
artifact_name: rustygate-linux-arm64 | |
sha_cmd: sha256sum | |
use_cross: true | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
artifact_name: rustygate-darwin-amd64 | |
sha_cmd: "shasum -a 256" | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
artifact_name: rustygate-darwin-arm64 | |
sha_cmd: "shasum -a 256" | |
container: ${{ matrix.container != '' && format('{0}', matrix.container) || null }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install basic dependencies (Alpine) | |
if: matrix.container != '' | |
run: | | |
apk add --no-cache \ | |
build-base \ | |
openssl-dev \ | |
openssl-libs-static \ | |
pkgconfig \ | |
gcc \ | |
musl-dev \ | |
bash \ | |
curl \ | |
perl \ | |
make | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Install cross | |
if: matrix.use_cross | |
run: | | |
curl -L https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz | tar xz | |
mv cross /usr/local/bin/ | |
chmod +x /usr/local/bin/cross | |
- name: Build binary | |
run: | | |
if [ "${{ matrix.use_cross }}" = "true" ]; then | |
cross build --release --target ${{ matrix.target }} | |
else | |
cargo build --release --target ${{ matrix.target }} | |
fi | |
cp target/${{ matrix.target }}/release/main ${{ matrix.artifact_name }} | |
- name: Generate SHA256 | |
run: | | |
${{ matrix.sha_cmd }} ${{ matrix.artifact_name }} > \ | |
${{ matrix.artifact_name }}.sha256 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact_name }} | |
path: | | |
${{ matrix.artifact_name }} | |
${{ matrix.artifact_name }}.sha256 | |
create-release: | |
needs: build-release | |
runs-on: ubuntu-latest | |
container: | |
image: alpine:3.19 | |
options: --user root | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
apk add --no-cache git curl | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
**/rustygate-* | |
generate_release_notes: true |