Skip to content

v0.1.6

v0.1.6 #9

Workflow file for this run

name: Release
on:
release:
types: [published]
permissions:
id-token: write
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: Set version from tag
shell: bash
run: |
VERSION="${GITHUB_REF_NAME#v}"
sed -i.bak 's/^version = ".*"/version = "'"$VERSION"'"/' Cargo.toml
- name: Install aarch64 cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
- name: Package (Unix)
if: runner.os != 'Windows'
run: tar czf apitally-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release apitally
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: Compress-Archive -Path target/${{ matrix.target }}/release/apitally.exe -DestinationPath apitally-${{ matrix.target }}.zip
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: apitally-${{ matrix.target }}
path: |
apitally-*.tar.gz
apitally-*.zip
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 24.x
registry-url: https://registry.npmjs.org
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: artifacts
merge-multiple: true
- name: Upload artifacts to release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
with:
files: artifacts/*
- name: Copy README
run: cp README.md npm/README.md
- name: Update version in package.json
run: npm version from-git --no-git-tag-version
working-directory: npm
- name: Publish to npm
run: npm publish --access public --provenance ${{ github.event.release.prerelease && '--tag next' || '' }}
working-directory: npm
- name: Set as latest release
if: github.event.release.prerelease == false
run: gh release edit ${{ github.event.release.tag_name }} --latest --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}