Skip to content

release: 0.2.0-beta.9.0.2 #37

release: 0.2.0-beta.9.0.2

release: 0.2.0-beta.9.0.2 #37

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build-and-release:
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
ext: .exe
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
ext: ""
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
ext: ""
- target: x86_64-apple-darwin
os: macos-latest
ext: ""
- target: aarch64-apple-darwin
os: macos-latest
ext: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tools (Linux cross)
if: contains(matrix.target, 'musl')
run: |
sudo apt-get update -qq
sudo apt-get install -y musl-tools
if [[ "${{ matrix.target }}" == "aarch64"* ]]; then
# cargo-zigbuild uses zig's bundled musl headers instead of glibc cross-compiler
# headers, which avoids open64/stat64/__*_chk symbols that don't exist in musl.
pip3 install ziglang
cargo install cargo-zigbuild --locked
fi
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
shell: bash
run: |
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]]; then
cargo zigbuild --release --target "${{ matrix.target }}"
else
cargo build --release --target "${{ matrix.target }}"
fi
- name: Package binary
shell: bash
run: |
BIN="infynon${{ matrix.ext }}"
SRC="target/${{ matrix.target }}/release/$BIN"
DEST="infynon-${{ matrix.target }}${{ matrix.ext }}"
cp "$SRC" "$DEST"
echo "ASSET=$DEST" >> $GITHUB_ENV
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ASSET }}
sync-go-version:
name: Sync Go wrapper version
needs: build-and-release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Sync version in Go wrapper
shell: bash
run: |
TAG="${GITHUB_REF_NAME#v}"
sed -i "s/version = \".*\"/version = \"$TAG\"/" go/main.go
echo "Synced Go wrapper to $TAG"
- name: Commit and push
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add go/main.go
git diff --cached --quiet && echo "No changes" && exit 0
git commit -m "ci: sync go wrapper version to ${GITHUB_REF_NAME}"
git push origin HEAD:main
- name: Trigger Go proxy indexing
run: |
TAG="${GITHUB_REF_NAME}"
curl -s "https://proxy.golang.org/github.com/d4rkNinja/infynon-cli/go/@v/${TAG}.info" || true
echo "Triggered Go proxy for ${TAG}"
publish-crates:
name: Publish to crates.io
needs: build-and-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Sync version from tag
shell: bash
run: |
TAG="${GITHUB_REF_NAME#v}"
sed -i "s/^version = \".*\"/version = \"$TAG\"/" Cargo.toml
echo "Publishing version $TAG to crates.io"
- name: Publish to crates.io
run: cargo publish --allow-dirty
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish-npm:
name: Publish to npm
needs: build-and-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Sync version from tag
shell: bash
run: |
TAG="${GITHUB_REF_NAME#v}"
cd npm
node -e "
const pkg = require('./package.json');
pkg.version = '$TAG';
require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');
"
echo "Publishing version $TAG"
- name: Publish
working-directory: npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}