Files
fristy d6ab83fc2e
CI / Docker image (pull_request) Successful in 17s
CI / CLI (pull_request) Successful in 18s
CI / Server (pull_request) Successful in 25s
CI / CLI (windows) (pull_request) Successful in 3m6s
CI / CLI (linux-arm64, static) (pull_request) Successful in 5m38s
fix(release): build the Linux CLI against musl
The x86-64 artifact was built on the 26.10 runner image and required glibc 2.44,
so it failed on older distributions. Build both Linux targets statically with
the image's zig toolchain and fail the job when the result is not static.
2026-11-17 16:06:00 +03:00

429 lines
15 KiB
YAML

name: Release
on:
push:
tags: ["v*"]
env:
REGISTRY: git.fristy.net
API: https://git.fristy.net/api/v1/repos/fristy/frislit
jobs:
prepare:
name: Prepare release
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
semver: ${{ steps.version.outputs.semver }}
steps:
- uses: actions/checkout@v7
- name: Read the version from the tag
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "semver=${VERSION%%-*}" >> "$GITHUB_OUTPUT"
- name: Open a draft release
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: |
body=$(cat <<JSON
{"tag_name":"${GITHUB_REF_NAME}","name":"frislit ${VERSION}","draft":true,"body":"Building the binaries and the image."}
JSON
)
code=$(curl -sS -o /tmp/release.json -w '%{http_code}' -X POST \
-H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \
-d "$body" "$API/releases")
echo "release create: HTTP $code"
[ "$code" = "201" ] || grep -q 'already exists' /tmp/release.json
cli:
name: "CLI (${{ matrix.name }})"
needs: prepare
runs-on: ${{ matrix.os }}
timeout-minutes: 90
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact: frislit-linux-x64
ext: ""
is_linux: true
is_musl: true
deb_arch: amd64
rpm_arch: x86_64
- name: windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
artifact: frislit-windows-x64.exe
ext: ".exe"
is_windows: true
msi_arch: x64
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
cli/target
key: ${{ runner.os }}-cargo-release-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-release-
- name: Put Git Bash on PATH
if: matrix.os == 'windows-latest'
shell: powershell
run: |
"C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
"C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Install Rust
if: matrix.os == 'windows-latest'
shell: powershell
run: |
if (Get-Command rustup -ErrorAction SilentlyContinue) {
rustup target add ${{ matrix.target }}
} else {
Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe -UseBasicParsing
./rustup-init.exe -y --default-toolchain stable --profile minimal --target ${{ matrix.target }}
"$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
}
- name: Add the static Linux target
if: matrix.is_musl
shell: bash
run: rustup target add ${{ matrix.target }}
- name: Stamp the version
shell: bash
env:
VERSION: ${{ needs.prepare.outputs.version }}
run: sed -i "s/^version = \".*\"/version = \"$VERSION\"/" cli/Cargo.toml
- name: Build the CLI (static)
if: matrix.is_musl
shell: bash
working-directory: cli
run: cargo zigbuild --release --target ${{ matrix.target }}
- name: Build the CLI
if: ${{ !matrix.is_musl }}
shell: bash
working-directory: cli
run: cargo build --release --target ${{ matrix.target }}
- name: Stage the binary
shell: bash
run: |
mkdir -p dist
cp "cli/target/${{ matrix.target }}/release/frislit${{ matrix.ext }}" "dist/${{ matrix.artifact }}"
- name: Check that the Linux binary is static
if: matrix.is_linux
shell: bash
run: |
file "dist/${{ matrix.artifact }}" | tee /dev/stderr | grep -Eq 'static(ally|-pie) linked'
- name: Build the .deb and the .rpm
if: matrix.is_linux
shell: bash
env:
PKG_VERSION: ${{ needs.prepare.outputs.semver }}
run: |
mkdir -p stage/cli
cp "dist/${{ matrix.artifact }}" stage/cli/frislit
chmod +x stage/cli/frislit
PKG_ARCH=${{ matrix.deb_arch }} nfpm pkg --config packaging/nfpm-cli.yaml --packager deb \
--target "dist/frislit-cli-${{ matrix.deb_arch }}.deb"
PKG_ARCH=${{ matrix.rpm_arch }} nfpm pkg --config packaging/nfpm-cli.yaml --packager rpm \
--target "dist/frislit-cli-${{ matrix.rpm_arch }}.rpm"
- name: Install WiX
if: matrix.os == 'windows-latest'
shell: bash
run: dotnet tool install --global wix --version 5.0.2
- name: Build the installer
if: matrix.os == 'windows-latest'
shell: bash
env:
PKG_VERSION: ${{ needs.prepare.outputs.semver }}
run: |
wix build packaging/windows/frislit.wxs \
-arch ${{ matrix.msi_arch }} \
-d Version="$PKG_VERSION" \
-d BinPath="dist/${{ matrix.artifact }}" \
-o "dist/frislit-${{ matrix.msi_arch }}.msi"
rm -f dist/*.wixpdb
- name: Upload the assets
shell: bash
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
id=$(curl -fsS -H "Authorization: token ${TOKEN}" "$API/releases/tags/${GITHUB_REF_NAME}" \
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
case "$id" in ''|null) echo "release not found"; exit 1 ;; esac
for file in dist/*; do
name=$(basename "$file")
echo "uploading $name"
code=$(curl -sS -o /tmp/upload.out -w '%{http_code}' -X POST \
-H "Authorization: token ${TOKEN}" -F "attachment=@$file" \
"$API/releases/${id}/assets?name=$name")
case "$code" in
200|201) echo "ok" ;;
409|422) echo "already there, skipping" ;;
*) echo "upload failed ($code)"; cat /tmp/upload.out; exit 1 ;;
esac
done
cli-arm64:
name: CLI (linux-arm64, static)
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
cli/target
key: ${{ runner.os }}-cargo-arm64-release-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-arm64-release-
- name: Stamp the version
env:
VERSION: ${{ needs.prepare.outputs.version }}
run: sed -i "s/^version = \".*\"/version = \"$VERSION\"/" cli/Cargo.toml
- name: Build the headless CLI
working-directory: cli
run: cargo zigbuild --release --target aarch64-unknown-linux-musl --no-default-features
- name: Stage the binary
run: |
mkdir -p dist stage/cli
cp cli/target/aarch64-unknown-linux-musl/release/frislit dist/frislit-linux-arm64
cp cli/target/aarch64-unknown-linux-musl/release/frislit stage/cli/frislit
chmod +x stage/cli/frislit
- name: Check that the binary is static
shell: bash
run: |
file dist/frislit-linux-arm64 | tee /dev/stderr | grep -Eq 'static(ally|-pie) linked'
- name: Build the .deb and the .rpm
env:
PKG_VERSION: ${{ needs.prepare.outputs.semver }}
run: |
PKG_ARCH=arm64 nfpm pkg --config packaging/nfpm-cli-static.yaml --packager deb \
--target "dist/frislit-cli-arm64.deb"
PKG_ARCH=aarch64 nfpm pkg --config packaging/nfpm-cli-static.yaml --packager rpm \
--target "dist/frislit-cli-aarch64.rpm"
- name: Upload the assets
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
id=$(curl -fsS -H "Authorization: token ${TOKEN}" "$API/releases/tags/${GITHUB_REF_NAME}" \
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
case "$id" in ''|null) echo "release not found"; exit 1 ;; esac
for file in dist/*; do
name=$(basename "$file")
echo "uploading $name"
code=$(curl -sS -o /tmp/upload.out -w '%{http_code}' -X POST \
-H "Authorization: token ${TOKEN}" -F "attachment=@$file" \
"$API/releases/${id}/assets?name=$name")
case "$code" in
200|201) echo "ok" ;;
409|422) echo "already there, skipping" ;;
*) echo "upload failed ($code)"; cat /tmp/upload.out; exit 1 ;;
esac
done
server:
name: "Server (${{ matrix.name }})"
needs: prepare
runs-on: ${{ matrix.os }}
timeout-minutes: 90
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-latest
artifact: frislit-server-linux-x64
ext: ""
is_linux: true
deb_arch: amd64
rpm_arch: x86_64
- name: windows-x64
os: windows-latest
artifact: frislit-server-windows-x64.exe
ext: ".exe"
steps:
- uses: actions/checkout@v7
- name: Put Git Bash on PATH
if: matrix.os == 'windows-latest'
shell: powershell
run: |
"C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
"C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Cache npm
if: matrix.os != 'windows-latest'
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json', 'client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/setup-node@v7
if: matrix.os == 'windows-latest'
with:
node-version: "26"
cache: "npm"
cache-dependency-path: |
package-lock.json
client/package-lock.json
- name: Install dependencies
shell: bash
run: |
npm ci --no-audit --no-fund
npm ci --no-audit --no-fund --prefix client
npm run build --prefix client
- name: Build the single executable
shell: bash
env:
BIN_NAME: frislit-server${{ matrix.ext }}
run: bash scripts/build-sea.sh
- name: Build the .deb and the .rpm
if: matrix.is_linux
shell: bash
env:
PKG_VERSION: ${{ needs.prepare.outputs.semver }}
run: |
mkdir -p stage/server dist
cp build/sea/frislit-server stage/server/frislit-server
chmod +x stage/server/frislit-server
PKG_ARCH=${{ matrix.deb_arch }} nfpm pkg --config packaging/nfpm-server.yaml --packager deb \
--target "dist/frislit-server-${{ matrix.deb_arch }}.deb"
PKG_ARCH=${{ matrix.rpm_arch }} nfpm pkg --config packaging/nfpm-server.yaml --packager rpm \
--target "dist/frislit-server-${{ matrix.rpm_arch }}.rpm"
- name: Upload the assets
shell: bash
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
mkdir -p dist
cp "build/sea/frislit-server${{ matrix.ext }}" "dist/${{ matrix.artifact }}"
id=$(curl -fsS -H "Authorization: token ${TOKEN}" "$API/releases/tags/${GITHUB_REF_NAME}" \
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
case "$id" in ''|null) echo "release not found"; exit 1 ;; esac
for file in dist/*; do
name=$(basename "$file")
echo "uploading $name"
code=$(curl -sS -o /tmp/upload.out -w '%{http_code}' -X POST \
-H "Authorization: token ${TOKEN}" -F "attachment=@$file" \
"$API/releases/${id}/assets?name=$name")
case "$code" in
200|201) echo "ok" ;;
409|422) echo "already there, skipping" ;;
*) echo "upload failed ($code)"; cat /tmp/upload.out; exit 1 ;;
esac
done
docker:
name: Docker image
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- uses: docker/setup-qemu-action@v4
- name: Log in to the registry
run: |
token="${{ secrets.REGISTRY_TOKEN }}"
[ -n "$token" ] || token="${{ secrets.GITEA_TOKEN }}"
echo "$token" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=${{ env.REGISTRY }}/fristy/frislit:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/fristy/frislit:buildcache,mode=max
build-args: |
VERSION=${{ needs.prepare.outputs.version }}
tags: |
${{ env.REGISTRY }}/fristy/frislit:${{ needs.prepare.outputs.version }}
${{ env.REGISTRY }}/fristy/frislit:latest
publish:
name: Publish release
needs: [prepare, cli, cli-arm64, server, docker]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Publish with notes from the changelog
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
VERSION: ${{ needs.prepare.outputs.version }}
run: |
id=$(curl -fsS -H "Authorization: token ${TOKEN}" "$API/releases/tags/${GITHUB_REF_NAME}" \
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
case "$id" in ''|null) echo "release not found"; exit 1 ;; esac
[ -n "$id" ] || { echo "release not found"; exit 1; }
body=$(cat <<JSON
{"draft":false,"body":"## Install\n\n\`\`\`sh\ndocker run -d --name frislit --restart always -p 127.0.0.1:8080:8080 \\\\\n -v frislit-data:/app/data \\\\\n -e FRISLIT_BASE_DOMAIN=frislit.example.com \\\\\n -e FRISLIT_PUBLIC_URL=https://frislit.example.com \\\\\n ${REGISTRY}/fristy/frislit:${VERSION}\n\`\`\`\n\nThe CLI and server assets are attached below. See CHANGELOG.md for the full list of changes."}
JSON
)
curl -fsS -X PATCH -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \
-d "$body" "$API/releases/${id}" > /dev/null
echo "release ${GITHUB_REF_NAME} published"