Files
wakey/.github/workflows/release.yml
T

190 lines
5.2 KiB
YAML

name: release
run-name: Release ${{ github.ref_name }}
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
env:
SQLX_OFFLINE: "true"
RELEASE_VERSION: ${{ github.ref_name }}
jobs:
router:
name: Router (ARMv7 musl)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: release-router-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: release-router-${{ runner.os }}-${{ runner.arch }}-
- name: Cache cross executable
id: cross
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cross
key: cross-${{ runner.os }}-${{ runner.arch }}-0.2.5
- name: Install cross
if: steps.cross.outputs.cache-hit != 'true'
run: cargo install cross --version 0.2.5 --locked
- name: Build router binaries
run: cross build --release --locked --target armv7-unknown-linux-musleabihf -p wakey -p wakey-agent
- name: Package rootfs tarball
shell: pwsh
run: ./scripts/package_rootfs.ps1 -Version $env:RELEASE_VERSION -Target armv7-unknown-linux-musleabihf
- name: Upload rootfs
uses: actions/upload-artifact@v4
with:
name: wakey-rootfs
path: dist/wakey-rootfs-*armv7-unknown-linux-musleabihf.tgz
if-no-files-found: error
compression-level: 0
ui:
name: UI
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml
- name: Build UI dist
working-directory: ui
run: |
pnpm install --frozen-lockfile
pnpm build
- name: Upload UI
uses: actions/upload-artifact@v4
with:
name: wakey-ui
path: ui/dist/
if-no-files-found: error
cc:
name: CC (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-24.04
- target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: release-cc-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: release-cc-${{ matrix.target }}-
# Native GNU builds use the runner's glibc. Gitea remains the separate
# older-glibc release path for deployment hosts that need it.
- name: Build control-plane natively
run: cargo build --release --locked --target ${{ matrix.target }} -p wakey-control-plane
- name: Upload control-plane binary
uses: actions/upload-artifact@v4
with:
name: wakey-cc-bin-${{ matrix.target }}
path: target/${{ matrix.target }}/release/wakey-control-plane
if-no-files-found: error
release:
name: Package and publish
needs: [router, ui, cc]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download rootfs
uses: actions/download-artifact@v4
with:
name: wakey-rootfs
path: dist
- name: Download UI
uses: actions/download-artifact@v4
with:
name: wakey-ui
path: ui/dist
- name: Download x86-64 CC
uses: actions/download-artifact@v4
with:
name: wakey-cc-bin-x86_64-unknown-linux-gnu
path: target/x86_64-unknown-linux-gnu/release
- name: Download ARM64 CC
uses: actions/download-artifact@v4
with:
name: wakey-cc-bin-aarch64-unknown-linux-gnu
path: target/aarch64-unknown-linux-gnu/release
- name: Package control-plane bundles
run: |
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
sh ./scripts/package_wakey_cc_bundle.sh --version "$RELEASE_VERSION" --target "$target"
done
- name: Upload control-plane bundles
uses: actions/upload-artifact@v4
with:
name: wakey-cc-bundles
path: dist/wakey-cc-*unknown-linux-gnu.tgz
if-no-files-found: error
compression-level: 0
- name: Publish Release to GitHub
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
fail_on_unmatched_files: true
files: |
dist/wakey-rootfs-*armv7-unknown-linux-musleabihf.tgz
dist/wakey-cc-*unknown-linux-gnu.tgz