release workflows #1
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: Upload Linux/MacOS | |
on: | |
workflow_call: | |
inputs: | |
release_id: | |
required: true | |
type: string | |
tag_name: | |
required: true | |
type: string | |
upload_hostname: | |
required: true | |
type: string | |
jobs: | |
publish-asset: | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
include: | |
- filename: l3-linux-x86_64 | |
runner: ubuntu-24.04 | |
target: x86_64-unknown-linux-gnu | |
- filename: l3-linux-aarch64 | |
runner: ubuntu-24.04 | |
target: aarch64-unknown-linux-gnu | |
apt_package_linker: gcc-aarch64-linux-gnu | |
- filename: l3-macos-x86_64 | |
runner: macos-latest | |
target: x86_64-apple-darwin | |
- filename: l3-macos-aarch64 | |
runner: macos-latest | |
target: aarch64-apple-darwin | |
env: | |
FILENAME: ${{ matrix.filename }} | |
TARGET: ${{ matrix.target }} | |
RELEASE_ID: ${{ inputs.release_id }} | |
UPLOAD_HOSTNAME: ${{ inputs.upload_hostname }} | |
steps: | |
- if: ${{ matrix.apt_package_linker }} | |
run: | |
- uses: actions/checkout@v4 | |
# with: | |
# ref: ${{ inputs.tag_name }} | |
- if: ${{ matrix.apt_package_linker }} | |
run: | | |
sudo apt update && sudo apt install ${{ matrix.apt_package_linker }} | |
mkdir -p $HOME/.cargo | |
mv ./.github/workflows/linkers.toml $HOME/.cargo/config.toml | |
- run: rustup install stable | |
- run: rustup target add $TARGET | |
- name: build | |
run: cargo build --release --target $TARGET | |
- name: upload | |
run: | | |
curl --fail --silent -L -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GH_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "Content-Type: $(file target/$TARGET/release/l3 -b --mime-type)" \ | |
https://$UPLOAD_HOSTNAME/repos/eighty4/l3/releases/$RELEASE_ID/assets?name=$FILENAME \ | |
--data-binary "@target/$TARGET/release/l3" | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} |