Skip to content

Merge pull request #9 from adeondev/release/v0.1.0-beta.6 #7

Merge pull request #9 from adeondev/release/v0.1.0-beta.6

Merge pull request #9 from adeondev/release/v0.1.0-beta.6 #7

Workflow file for this run

name: Release Server & Container
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
workflow_dispatch:
concurrency:
group: release-server-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
packages: write
jobs:
build-binaries:
name: Build Binary (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: stapp-server-windows-x86_64
archive_name: stapp-server-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
artifact_name: stapp-server-linux-x86_64
archive_name: stapp-server-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: './server -> target'
key: ${{ matrix.target }}
- name: Install frontend dependencies
working-directory: ./web
run: pnpm install --no-frozen-lockfile
- name: Build frontend web client
working-directory: ./web
run: pnpm build
- name: Build standalone server binary
run: cargo build --manifest-path server/Cargo.toml --release --bin stapp-server --target ${{ matrix.target }}
- name: Package Windows archive
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Path dist-pkg
Copy-Item "server/target/${{ matrix.target }}/release/stapp-server.exe" -Destination dist-pkg/
Copy-Item "server/stapp.toml" -Destination dist-pkg/
Compress-Archive -Path dist-pkg/* -DestinationPath "${{ matrix.archive_name }}"
- name: Package Linux archive
if: runner.os == 'Linux'
run: |
mkdir -p dist-pkg
cp "server/target/${{ matrix.target }}/release/stapp-server" dist-pkg/
cp "server/stapp.toml" dist-pkg/
tar -czvf "${{ matrix.archive_name }}" -C dist-pkg .
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.archive_name }}
if-no-files-found: error
publish-release:
name: Publish GitHub Release
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Download all binary artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: release-assets
- name: Publish to GitHub Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: release-assets/*
generate_release_notes: true
build-and-push-docker:
name: Build & Push GHCR Container
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Checkout repository
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: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
- name: Build and push multi-arch Docker image
uses: docker/build-push-action@v6
with:
context: .
file: server/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max