The paths filter was applied to tag events, preventing site rebuilds when releases don't include site changes. Switch to release event trigger which always fires on new releases, ensuring the site fetches the latest version from GitHub API. Closes #1992
144 lines
4.0 KiB
YAML
144 lines
4.0 KiB
YAML
name: site
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- ".github/workflows/ci-site.yml"
|
|
- "site/**"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/ci-site.yml"
|
|
- "site/**"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build site image (${{ matrix.platform }})
|
|
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
|
|
runs-on: ${{ matrix.runner }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
artifact: linux-amd64
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
artifact: linux-arm64
|
|
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: login to ghcr.io
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.PKG_TOKEN }}
|
|
|
|
- name: build and push by digest
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./site
|
|
platforms: ${{ matrix.platform }}
|
|
cache-from: type=gha,scope=site-${{ matrix.platform }}
|
|
cache-to: type=gha,scope=site-${{ matrix.platform }},mode=max
|
|
outputs: type=image,name=ghcr.io/umputun/remark42-site,push-by-digest=true,name-canonical=true,push=true
|
|
|
|
- name: export digest
|
|
run: |
|
|
mkdir -p /tmp/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
- name: upload digest
|
|
uses: actions/upload-artifact@v5
|
|
with:
|
|
name: site-digests-${{ matrix.artifact }}
|
|
path: /tmp/digests/*
|
|
retention-days: 1
|
|
|
|
merge:
|
|
name: Create site multi-arch manifest
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: download digests
|
|
uses: actions/download-artifact@v6
|
|
with:
|
|
path: /tmp/digests
|
|
pattern: site-digests-*
|
|
merge-multiple: true
|
|
|
|
- name: verify all digests present
|
|
run: |
|
|
expected=2
|
|
actual=$(find /tmp/digests -maxdepth 1 -type f | wc -l)
|
|
if [ "$actual" -ne "$expected" ]; then
|
|
echo "Expected $expected digests, found $actual"
|
|
ls -la /tmp/digests
|
|
exit 1
|
|
fi
|
|
echo "All $expected digests present"
|
|
|
|
- name: set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: login to ghcr.io
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.PKG_TOKEN }}
|
|
|
|
- name: create manifest and push
|
|
working-directory: /tmp/digests
|
|
env:
|
|
GITHUB_REF: ${{ github.ref }}
|
|
run: |
|
|
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
|
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
docker buildx imagetools create \
|
|
-t ghcr.io/umputun/remark42-site:${ref} \
|
|
-t ghcr.io/umputun/remark42-site:latest \
|
|
$(printf 'ghcr.io/umputun/remark42-site@sha256:%s ' *)
|
|
else
|
|
docker buildx imagetools create \
|
|
-t ghcr.io/umputun/remark42-site:${ref} \
|
|
$(printf 'ghcr.io/umputun/remark42-site@sha256:%s ' *)
|
|
fi
|
|
|
|
deploy:
|
|
name: Deploy site
|
|
runs-on: ubuntu-latest
|
|
needs: merge
|
|
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
|
|
|
|
steps:
|
|
- name: trigger deployment
|
|
env:
|
|
UPDATER_KEY: ${{ secrets.UPDATER_KEY }}
|
|
run: curl -sf https://jess.umputun.com/update/remark42-site/${UPDATER_KEY}
|