Leo Release #112
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: Leo Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "The release tag (e.g., v1.0.0)." | |
required: true | |
release_flag: | |
description: "Set to true to upload the release, false to skip." | |
required: false | |
default: "false" | |
env: | |
RUST_BACKTRACE: 0 | |
jobs: | |
ubuntu: | |
name: Ubuntu | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Specific Tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Verify Cargo.lock Exists | |
run: | | |
if [ ! -f Cargo.lock ]; then | |
echo "Error: Cargo.lock file is missing. Aborting build." | |
exit 1 | |
fi | |
- name: Build Leo | |
run: | | |
cargo build --package leo-lang --release --locked --features noconfig && strip target/release/leo | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Zip Artifact | |
run: | | |
mkdir tempdir | |
mv target/release/leo tempdir | |
cd tempdir | |
zip -r leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-gnu.zip leo | |
cd .. | |
mv tempdir/leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-gnu.zip . | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event.inputs.release_flag == 'true' }} | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
files: | | |
leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-gnu.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
linux-musl: | |
name: Linux musl | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Specific Tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt | |
target: x86_64-unknown-linux-musl | |
- name: Verify Cargo.lock Exists | |
run: | | |
if [ ! -f Cargo.lock ]; then | |
echo "Error: Cargo.lock file is missing. Aborting build." | |
exit 1 | |
fi | |
- name: Build | |
run: | | |
docker pull clux/muslrust:stable | |
docker run \ | |
-v ${{ github.workspace }}:/volume \ | |
-v cargo-cache:/root/.cargo/registry \ | |
--rm \ | |
-t clux/muslrust:stable \ | |
bash -c " | |
rustup install stable && | |
rustup default stable && | |
rustup target add x86_64-unknown-linux-musl && | |
cargo build --target x86_64-unknown-linux-musl --package leo-lang --release --locked --features noconfig | |
" | |
- name: Check Binary | |
run: file target/x86_64-unknown-linux-musl/release/leo | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Zip Artifact | |
run: | | |
mkdir tempdir | |
cp target/x86_64-unknown-linux-musl/release/leo tempdir | |
strip tempdir/leo | |
cd tempdir | |
zip -r leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-musl.zip leo | |
cd .. | |
mv tempdir/leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-musl.zip . | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event.inputs.release_flag == 'true' }} | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
files: | | |
leo-${{ steps.get_version.outputs.version }}-x86_64-unknown-linux-musl.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
macos: | |
name: macOS | |
runs-on: macos-13 | |
steps: | |
- name: Checkout Specific Tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Verify Cargo.lock Exists | |
run: | | |
if [ ! -f Cargo.lock ]; then | |
echo "Error: Cargo.lock file is missing. Aborting build." | |
exit 1 | |
fi | |
- name: Build Leo | |
run: | | |
cargo build --package leo-lang --release --locked && strip target/release/leo | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Zip Artifact | |
run: | | |
mkdir tempdir | |
mv target/release/leo tempdir | |
cd tempdir | |
zip -r leo-${{ steps.get_version.outputs.version }}-x86_64-apple-darwin.zip leo | |
cd .. | |
mv tempdir/leo-${{ steps.get_version.outputs.version }}-x86_64-apple-darwin.zip . | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event.inputs.release_flag == 'true' }} | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
files: | | |
leo-${{ steps.get_version.outputs.version }}-x86_64-apple-darwin.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
macos_m1: | |
name: macOS M1 | |
runs-on: macos-latest | |
steps: | |
- name: Xcode Select | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- name: Checkout Specific Tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
profile: minimal | |
target: aarch64-apple-darwin | |
components: rustfmt | |
- name: Verify Cargo.lock Exists | |
run: | | |
if [ ! -f Cargo.lock ]; then | |
echo "Error: Cargo.lock file is missing. Aborting build." | |
exit 1 | |
fi | |
- name: Build Leo | |
run: | | |
SDKROOT=$(xcrun --sdk macosx --show-sdk-path) \ | |
MACOSX_DEPLOYMENT_TARGET=$(xcrun --sdk macosx --show-sdk-platform-version) \ | |
cargo build --package leo-lang --release --locked --target=aarch64-apple-darwin --features noconfig | |
strip target/aarch64-apple-darwin/release/leo | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Zip Artifact | |
run: | | |
mkdir tempdir | |
mv target/aarch64-apple-darwin/release/leo tempdir | |
cd tempdir | |
zip -r leo.zip leo | |
cp leo.zip leo-${{ steps.get_version.outputs.version }}-aarch64-apple-darwin.zip | |
cd .. | |
mv tempdir/leo-${{ steps.get_version.outputs.version }}-aarch64-apple-darwin.zip . | |
mv tempdir/leo.zip . | |
- name: Release macOS M1 Version | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event.inputs.release_flag == 'true' }} | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
files: | | |
leo-${{ steps.get_version.outputs.version }}-aarch64-apple-darwin.zip | |
- name: Release Universal Version | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event.inputs.release_flag == 'true' }} | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
files: | | |
leo.zip | |
windows: | |
name: Windows | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Specific Tag | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Install LLVM and Clang | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "11" # Specify the LLVM/Clang version you need | |
directory: ${{ runner.temp }}/llvm | |
- name: Set LIBCLANG_PATH | |
run: echo "LIBCLANG_PATH=${{ runner.temp }}/llvm/lib" >> $GITHUB_ENV | |
- name: Verify Cargo.lock Exists | |
run: | | |
if (!(Test-Path "Cargo.lock")) { | |
Write-Host "Error: Cargo.lock file is missing. Aborting build." | |
exit 1 | |
} | |
- name: Build Leo | |
run: | | |
cargo build --package leo-lang --release --locked --features noconfig | |
env: | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
- id: get_version | |
uses: battila7/get-version-action@v2 | |
- name: Zip Artifact | |
run: | | |
Compress-Archive target/release/leo.exe leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-msvc.zip | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event.inputs.release_flag == 'true' }} | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
files: | | |
leo-${{ steps.get_version.outputs.version }}-x86_64-pc-windows-msvc.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |