Release #57
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
prerelease: | |
description: | | |
The semantic version pre-release string. | |
E.g. in `v1.2.3-beta.2` the pre-release string is `beta.3`. | |
required: false | |
push: | |
tags: | |
- "*" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
setup: | |
name: Get release parameters | |
outputs: | |
SEMANTIC_VERSION: ${{ steps.params.outputs.SEMANTIC_VERSION }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get release parameters | |
id: params | |
run: | | |
IDL2JSON_CARGO_VERSION="$(cargo metadata --locked | jq -r '.packages[] | select(.name == "idl2json") | .version')" | |
PRERELEASE="${{ github.event.inputs.prerelease }}" | |
SEMANTIC_VERSION="${IDL2JSON_CARGO_VERSION}${PRERELEASE:+-}${PRERELEASE}" | |
( | |
for var in IDL2JSON_CARGO_VERSION PRERELEASE SEMANTIC_VERSION ; do | |
echo "$var=${!var}" | |
done | |
) | tee -a $GITHUB_OUTPUT | |
#- Tag, if there isn't one already on this commit | |
#- name: Create a draft release if there isn't one already | |
build: | |
name: Release binary for ${{ matrix.name }} | |
needs: setup | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
name: linux | |
target_dir: target/x86_64-unknown-linux-musl/release/ | |
asset_name: idl2json_cli-x86_64-unknown-linux-musl.tar.gz | |
old_name: idl2json-linux-x86_64.tar.gz | |
make_target: musl-static | |
build: musl | |
pack: tar | |
# - os: windows-latest | |
# name: windows | |
# target_dir: target/release/ | |
# asset_name: idl2json-windows-x86_64 | |
# make_target: release | |
# rust: 1.60.0 | |
- os: macos-latest | |
name: macos | |
target_dir: target/release/ | |
asset_name: idl2json_cli-x86_64-apple-darwin.zip | |
old_name: idl2json-macos-x86_64.zip | |
make_target: release | |
rust: 1.60.0 | |
build: cargo | |
pack: zip | |
# - os: ubuntu-latest | |
# name: arm | |
# target_file: target/arm-unknown-linux-gnueabihf/release/{idl2json,yaml2candid} | |
# asset_name: idl2json-arm_32 | |
# make_target: unused | |
# rust: 1.60.0 | |
steps: | |
- name: Stop, we are just testing | |
run: | | |
echo SEMANTIC_VERSION="${{ needs.setup.outputs.SEMANTIC_VERSION }}" | |
false | |
- uses: actions/checkout@v4 | |
# BUILD | |
- name: Static build with musl | |
if: matrix.build == 'musl' | |
uses: mariodfinity/rust-musl-action@master | |
with: | |
args: make ${{ matrix.make_target }} | |
- name: Install toolchain (ARM) | |
if: matrix.name == 'arm' | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust }} | |
override: true | |
target: arm-unknown-linux-gnueabihf | |
- name: Build with cargo | |
if: matrix.build == 'cargo' | |
run: make ${{ matrix.make_target }} | |
- name: Cross build | |
if: matrix.name == 'arm' | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --target arm-unknown-linux-gnueabihf --features static-ssl --release --locked | |
# ZIP | |
- name: tar the results | |
if: matrix.pack == 'tar' | |
run: | | |
tar -C "${{ matrix.target_dir }}" -czvf "$PWD/${{ matrix.asset_name }}" idl2json yaml2candid | |
- name: zip the results | |
if: matrix.pack == 'zip' | |
run: | | |
zipfile="$PWD/${{ matrix.asset_name }}" | |
cd "${{ matrix.target_dir }}" | |
zip "$zipfile" idl2json yaml2candid | |
- name: Support the old download location | |
run: cp "${{ matrix.asset_name }}" "${{ matrix.old_name }}" | |
# UPLOAD | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "${{ matrix.asset_name }}" | |
tag: "${{ github.ref }}" | |
publish_idl2json: | |
needs: build | |
name: Publish idl2json to crates.io | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- package: idl2json | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish ${{ matrix.package }} | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish -p "${{ matrix.package }}" | |
publish_idl2json_cli: | |
needs: publish_idl2json | |
name: Publish idl2json_cli to crates.io | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- package: idl2json_cli | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish ${{ matrix.package }} | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish -p "${{ matrix.package }}" |