Skip to content

Create Cross.toml

Create Cross.toml #51

Workflow file for this run

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 xtask
run: cargo install cargo-xtask
- name: Install configure-crosstool
run: cargo xtask configure-crosstool aarch64-apple-darwin x86_64-apple-darwin
- 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-gnu/
cp target/aarch64-unknown-linux-gnu/release/easy-proxy build/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: Build macOS binary aarch64
run: |
cross build --target aarch64-apple-darwin --release
mkdir -p build/macos-aarch64
cp target/aarch64-apple-darwin/release/easy-proxy build/macos-aarch64/
- name: Build macOS binary x86_64
run: |
cross build --target x86_64-apple-darwin --release
mkdir -p build/macos-x86_64
cp target/x86_64-apple-darwin/release/easy-proxy build/macos-x86_64/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.sha }}
release_name: "Release ${{ github.sha }}"
draft: false
prerelease: false
- name: Upload Linux binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/linux/easy-proxy
asset_name: easy-proxy-linux
asset_content_type: application/octet-stream
- name: Upload macOS binary to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/macos/easy-proxy
asset_name: easy-proxy-macos
asset_content_type: application/octet-stream