Skip to content

docs: update READMEs, landing page, and npm for v0.6.0 release #11

docs: update READMEs, landing page, and npm for v0.6.0 release

docs: update READMEs, landing page, and npm for v0.6.0 release #11

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
archive: tar.gz
use-cross: false
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
archive: tar.gz
use-cross: true
- target: x86_64-apple-darwin
runner: macos-14
archive: tar.gz
use-cross: false
- target: aarch64-apple-darwin
runner: macos-14
archive: tar.gz
use-cross: false
- target: x86_64-pc-windows-msvc
runner: windows-latest
archive: zip
use-cross: false
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup update stable
rustup default stable
rustup target add ${{ matrix.target }}
- name: Install cross
if: matrix.use-cross
run: cargo install cross --locked
- name: Build
run: |
if [ "${{ matrix.use-cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }}
else
cargo build --release --target ${{ matrix.target }}
fi
shell: bash
- name: Package (Unix)
if: matrix.archive == 'tar.gz'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../authy-${{ matrix.target }}.tar.gz authy
shell: bash
- name: Package (Windows)
if: matrix.archive == 'zip'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../authy-${{ matrix.target }}.zip authy.exe
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: authy-${{ matrix.target }}
path: authy-${{ matrix.target }}.${{ matrix.archive }}
release:
name: GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: artifacts/**/*
npm-publish:
name: Publish npm package
needs: [build, release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Place binaries into npm package
run: |
# Linux x64
tar xzf artifacts/authy-x86_64-unknown-linux-gnu/authy-x86_64-unknown-linux-gnu.tar.gz -C /tmp
mv /tmp/authy npm/authy-cli/bin/authy-linux-x64
# Linux arm64
tar xzf artifacts/authy-aarch64-unknown-linux-gnu/authy-aarch64-unknown-linux-gnu.tar.gz -C /tmp
mv /tmp/authy npm/authy-cli/bin/authy-linux-arm64
# macOS x64
tar xzf artifacts/authy-x86_64-apple-darwin/authy-x86_64-apple-darwin.tar.gz -C /tmp
mv /tmp/authy npm/authy-cli/bin/authy-darwin-x64
# macOS arm64
tar xzf artifacts/authy-aarch64-apple-darwin/authy-aarch64-apple-darwin.tar.gz -C /tmp
mv /tmp/authy npm/authy-cli/bin/authy-darwin-arm64
# Windows x64
cd artifacts/authy-x86_64-pc-windows-msvc
7z x authy-x86_64-pc-windows-msvc.zip -o/tmp/win
cd ../..
mv /tmp/win/authy.exe npm/authy-cli/bin/authy-win32-x64.exe
# Make all binaries executable
chmod +x npm/authy-cli/bin/authy-*
- name: Update package version
run: |
VERSION="${{ steps.version.outputs.version }}"
jq --arg v "$VERSION" '.version = $v' npm/authy-cli/package.json > npm/authy-cli/package.json.tmp
mv npm/authy-cli/package.json.tmp npm/authy-cli/package.json
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish ./npm/authy-cli --access public