2025-03-02 19:54:41 +01:00
|
|
|
# .github/workflows/deploy.yml
|
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# branches:
|
|
|
|
# - 'main'
|
2025-03-02 20:37:33 +01:00
|
|
|
tags: [ "v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*" ]
|
2025-03-02 19:54:41 +01:00
|
|
|
workflow_dispatch:
|
|
|
|
repository_dispatch:
|
|
|
|
types: [ webhook ]
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-upload:
|
|
|
|
name: Build and upload
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
# You can add more, for any target you'd like!
|
|
|
|
include:
|
|
|
|
- build: linux x86
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
- build: linux arm64
|
|
|
|
os: ubuntu-latest
|
|
|
|
target: aarch64-unknown-linux-musl
|
|
|
|
|
|
|
|
- build: macos x86
|
|
|
|
os: macos-latest
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
- build: macos arm64
|
|
|
|
os: macos-latest
|
|
|
|
target: aarch64-apple-darwin
|
|
|
|
|
|
|
|
- build: win x86
|
|
|
|
os: windows-latest
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
# - build: win arm64
|
|
|
|
# os: windows-latest
|
|
|
|
# target: aarch64-pc-windows-msvc
|
|
|
|
# error: failed to run custom build command for `mozjpeg-sys v*`
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Get the release version from the tag
|
|
|
|
shell: bash
|
|
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install Rust
|
|
|
|
# Or @nightly if you want
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
# Arguments to pass in
|
|
|
|
with:
|
|
|
|
# Make Rust compile to our target (defined in the matrix)
|
|
|
|
targets: ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
uses: clechasseur/rs-cargo@v2
|
|
|
|
with:
|
|
|
|
use-cross: true
|
|
|
|
command: build
|
|
|
|
args: --verbose --release --target ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: Build archive
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
# Replace with the name of your binary
|
|
|
|
binary_name="caesiumclt"
|
|
|
|
|
|
|
|
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
|
|
|
|
mkdir "$dirname"
|
|
|
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
|
|
|
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
|
|
|
|
else
|
|
|
|
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
|
|
|
7z a "$dirname.zip" "$dirname"
|
|
|
|
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
tar -czf "$dirname.tar.gz" "$dirname"
|
|
|
|
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
|
|
|
# https://github.com/softprops/action-gh-release?tab=readme-ov-file#-customizing
|
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v2
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
${{ env.ASSET }}
|
|
|
|
# body_path: ''
|
|
|
|
body: "|Arch|Filename|\n
|
|
|
|
|:--: |:--:|\n
|
|
|
|
|MacOS ARM| caesiumclt-v*-aarch64-apple-darwin.tar.gz|\n
|
|
|
|
|MacOS x86_64| caesiumclt-v*-x86_64-apple-darwin.tar.gz|\n
|
|
|
|
|Linux ARM| caesiumclt-v*-aarch64-unknown-linux-musl.tar.gz|\n
|
|
|
|
|Linux x86_64| caesiumclt-v*-x86_64-unknown-linux-musl.tar.gz|\n
|
|
|
|
|Windows x86_64| caesiumclt-v*-x86_64-pc-windows-msvc.zip|\n"
|
|
|
|
|
|
|
|
- name: Upload Artifact 🚀
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: ${{ env.ASSET }}
|
|
|
|
path: ${{ env.ASSET }}
|
|
|
|
|
|
|
|
- name: Upload binaries to release ☕
|
|
|
|
uses: svenstaro/upload-release-action@v2
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: ${{ env.ASSET }}
|
|
|
|
asset_name: ${{ env.ASSET }}
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
|
|
|
body: "Generated by Github Actions"
|