210 lines
6.1 KiB
YAML
210 lines
6.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
# ==========================================================================
|
|
# Build Web UI
|
|
# ==========================================================================
|
|
build-webui:
|
|
name: Build Web UI
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- name: Install dependencies
|
|
working-directory: webui
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
working-directory: webui
|
|
run: pnpm build
|
|
|
|
- name: Upload Web UI artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: webui-dist
|
|
path: webui/dist
|
|
|
|
# ==========================================================================
|
|
# Build Binaries
|
|
# ==========================================================================
|
|
build-binaries:
|
|
name: Build (${{ matrix.target }})
|
|
needs: build-webui
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
name: galvanize-linux-x86_64
|
|
- target: aarch64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
name: galvanize-linux-aarch64
|
|
- target: x86_64-apple-darwin
|
|
os: macos-latest
|
|
name: galvanize-darwin-x86_64
|
|
- target: aarch64-apple-darwin
|
|
os: macos-latest
|
|
name: galvanize-darwin-aarch64
|
|
- target: x86_64-pc-windows-msvc
|
|
os: windows-latest
|
|
name: galvanize-windows-x86_64.exe
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download Web UI artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: webui-dist
|
|
path: webui/dist
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-action@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Install cross-compilation tools
|
|
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
|
|
- name: Build binary
|
|
run: cargo build --release --target ${{ matrix.target }} --features webui
|
|
env:
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
|
|
- name: Prepare binary (Unix)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
cp target/${{ matrix.target }}/release/galvanize ${{ matrix.name }}
|
|
chmod +x ${{ matrix.name }}
|
|
|
|
- name: Prepare binary (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: cp target/${{ matrix.target }}/release/galvanize.exe ${{ matrix.name }}
|
|
|
|
- name: Upload binary
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.name }}
|
|
path: ${{ matrix.name }}
|
|
|
|
# ==========================================================================
|
|
# Build Docker Image
|
|
# ==========================================================================
|
|
build-docker:
|
|
name: Build Docker Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
aitiome/galvanize:latest
|
|
aitiome/galvanize:${{ steps.version.outputs.VERSION }}
|
|
ghcr.io/aitiome/galvanize:latest
|
|
ghcr.io/aitiome/galvanize:${{ steps.version.outputs.VERSION }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
# ==========================================================================
|
|
# Create GitHub Release
|
|
# ==========================================================================
|
|
create-release:
|
|
name: Create Release
|
|
needs: [build-binaries, build-docker]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create checksums
|
|
run: |
|
|
cd artifacts
|
|
for dir in galvanize-*; do
|
|
if [ -d "$dir" ]; then
|
|
cd "$dir"
|
|
sha256sum * > ../checksums-$dir.txt
|
|
cd ..
|
|
fi
|
|
done
|
|
cat checksums-*.txt > SHA256SUMS.txt
|
|
rm checksums-*.txt
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: Galvanize v${{ steps.version.outputs.VERSION }}
|
|
draft: false
|
|
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
|
|
generate_release_notes: true
|
|
files: |
|
|
artifacts/galvanize-linux-x86_64/*
|
|
artifacts/galvanize-linux-aarch64/*
|
|
artifacts/galvanize-darwin-x86_64/*
|
|
artifacts/galvanize-darwin-aarch64/*
|
|
artifacts/galvanize-windows-x86_64.exe/*
|
|
artifacts/SHA256SUMS.txt
|
|
|