Skip to content

Deploy prebuilt binaries #12

Deploy prebuilt binaries

Deploy prebuilt binaries #12

Workflow file for this run

name: Deploy
run-name: Deploy prebuilt binaries
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
env:
CI: true
NODE_ENV: production
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux x86_64
- build: linux (x86_64)
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: libxid.so
# MacOS x86_64
- build: macos (x86_64)
os: macos-latest
target: x86_64-apple-darwin
binary: libxid.dylib
# MacOS ARM64
- build: macos (aarch64)
os: macos-latest
target: aarch64-apple-darwin
binary: libxid.dylib
# Windows x86_64
- build: windows-gnu (x86_64)
os: windows-latest
target: x86_64-pc-windows-gnu
binary: xid.dll
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get version
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: xid-${{ env.VERSION }}-${{ matrix.target }}
path: target/${{ matrix.target }}/release/${{ matrix.binary }}
release:
name: Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ./binaries
- name: Zip Artifacts
run: |
for folder in binaries/*; do
zip -r "$folder.zip" "$folder"
done
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./binaries/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}