chore: restart the repository with a clean history
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md.
This commit is contained in:
438 files changed
+45070
No files matched your search
@@ -0,0 +1,150 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
server:
|
||||
name: Server
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Cache npm
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json', 'client/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-npm-
|
||||
|
||||
- name: Install server dependencies
|
||||
run: npm ci --no-audit --no-fund
|
||||
|
||||
- name: Build the web interface
|
||||
run: |
|
||||
npm ci --no-audit --no-fund --prefix client
|
||||
npm run build --prefix client
|
||||
|
||||
- name: Lint the web interface
|
||||
run: npm run lint --prefix client
|
||||
|
||||
- name: Test the server
|
||||
run: npm test
|
||||
|
||||
cli:
|
||||
name: CLI
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Cache cargo
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
cli/target
|
||||
key: ${{ runner.os }}-cargo-check-${{ hashFiles('cli/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-check-
|
||||
|
||||
- name: Check the CLI
|
||||
run: cargo check --manifest-path cli/Cargo.toml
|
||||
|
||||
cli-windows:
|
||||
name: CLI (windows)
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Install Rust
|
||||
shell: powershell
|
||||
run: |
|
||||
if (Get-Command rustup -ErrorAction SilentlyContinue) {
|
||||
rustup show active-toolchain
|
||||
} else {
|
||||
Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe -UseBasicParsing
|
||||
./rustup-init.exe -y --default-toolchain stable --profile minimal
|
||||
"$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||
}
|
||||
|
||||
- name: Report the toolchain
|
||||
shell: powershell
|
||||
run: |
|
||||
rustc --version
|
||||
cargo --version
|
||||
dotnet --version 2>$null
|
||||
if (Get-Command wix -ErrorAction SilentlyContinue) { wix --version }
|
||||
|
||||
- name: Put Git Bash on PATH
|
||||
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: Check that bash works
|
||||
shell: bash
|
||||
run: |
|
||||
bash --version | head -1
|
||||
sed --version | head -1
|
||||
echo "bash-and-sed-ok"
|
||||
|
||||
- name: Check the CLI on Windows
|
||||
shell: powershell
|
||||
run: cargo check --manifest-path cli/Cargo.toml
|
||||
|
||||
docker:
|
||||
name: Docker image
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Build the image
|
||||
run: docker build -t frislit:ci .
|
||||
|
||||
- name: Scan the image
|
||||
run: |
|
||||
trivy image --quiet --format json --severity HIGH,CRITICAL --ignore-unfixed \
|
||||
--output report.json frislit:ci
|
||||
|
||||
jq -r '.Results[]?.Vulnerabilities[]? | "\(.Severity) \(.VulnerabilityID) \(.PkgName) \(.InstalledVersion)"' report.json \
|
||||
| sort | uniq -c | sort -rn | head -40
|
||||
|
||||
high=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "HIGH")] | length' report.json)
|
||||
critical=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "CRITICAL")] | length' report.json)
|
||||
echo "HIGH=$high CRITICAL=$critical (unfixed findings ignored)"
|
||||
|
||||
if [ "$critical" -gt 0 ]; then
|
||||
echo "::error::The image has $critical CRITICAL vulnerabilities"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cli-arm64:
|
||||
name: CLI (linux-arm64, static)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
continue-on-error: true
|
||||
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-${{ hashFiles('cli/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-arm64-
|
||||
|
||||
- name: Cross-compile for arm64
|
||||
working-directory: cli
|
||||
run: cargo zigbuild --release --target aarch64-unknown-linux-musl --no-default-features
|
||||
@@ -0,0 +1,47 @@
|
||||
name: Development image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: git.fristy.net
|
||||
|
||||
jobs:
|
||||
development:
|
||||
name: Development image
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
if: "!startsWith(github.event.head_commit.message, 'Release ')"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Name this build
|
||||
id: build
|
||||
run: echo "version=0.0.0-dev.$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- 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
|
||||
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ github.repository }}:buildcache,mode=max
|
||||
build-args: |
|
||||
VERSION=${{ steps.build.outputs.version }}
|
||||
tags: ${{ env.REGISTRY }}/${{ github.repository }}:development
|
||||
@@ -0,0 +1,406 @@
|
||||
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-gnu
|
||||
artifact: frislit-linux-x64
|
||||
ext: ""
|
||||
is_linux: 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
|
||||
if: matrix.os != 'windows-latest'
|
||||
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: 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
|
||||
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: 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
|
||||
continue-on-error: true
|
||||
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-${{ hashFiles('cli/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-arm64-
|
||||
|
||||
- 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: 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, 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"
|
||||
Reference in new issue
Block a user