Bumps the github-actions-updates group with 3 updates: [actions/cache](https://github.com/actions/cache), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/cache` from 4 to 5 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v5) Updates `actions/upload-artifact` from 5 to 6 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v5...v6) Updates `actions/download-artifact` from 6 to 7 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: actions/upload-artifact dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: actions/download-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com>
143 lines
3.9 KiB
YAML
143 lines
3.9 KiB
YAML
name: site
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
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@v6
|
|
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@v7
|
|
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'
|
|
|
|
steps:
|
|
- name: trigger deployment
|
|
env:
|
|
UPDATER_KEY: ${{ secrets.UPDATER_KEY }}
|
|
run: curl -sf https://jess.umputun.com/update/remark42-site/${UPDATER_KEY}
|