5d6599237d
Bumps the github-actions-updates group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3` | `4` | | [pnpm/action-setup](https://github.com/pnpm/action-setup) | `4.2.0` | `5.0.0` | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `5` | `6` | | [docker/login-action](https://github.com/docker/login-action) | `3` | `4` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `6` | `7` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `6` | `7` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `7` | `8` | Updates `docker/setup-buildx-action` from 3 to 4 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v3...v4) Updates `pnpm/action-setup` from 4.2.0 to 5.0.0 - [Release notes](https://github.com/pnpm/action-setup/releases) - [Commits](https://github.com/pnpm/action-setup/compare/v4.2.0...v5.0.0) Updates `codecov/codecov-action` from 5 to 6 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v5...v6) Updates `docker/login-action` from 3 to 4 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v3...v4) Updates `docker/build-push-action` from 6 to 7 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v6...v7) Updates `actions/upload-artifact` from 6 to 7 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v6...v7) Updates `actions/download-artifact` from 7 to 8 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v7...v8) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: pnpm/action-setup dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: codecov/codecov-action dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: docker/login-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: docker/build-push-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions-updates ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
216 lines
7.0 KiB
YAML
216 lines
7.0 KiB
YAML
name: docker
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [backend]
|
|
types: [completed]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Docker image (${{ matrix.platform }})
|
|
if: >-
|
|
github.event.workflow_run.conclusion == 'success' &&
|
|
github.event.workflow_run.event != 'pull_request' &&
|
|
(github.event.workflow_run.head_branch == 'master' ||
|
|
startsWith(github.event.workflow_run.head_branch, 'v'))
|
|
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
|
|
runs-on: ${{ matrix.runner }}
|
|
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.event.workflow_run.head_sha }}
|
|
persist-credentials: false
|
|
|
|
- name: set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: login to ghcr.io
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.PKG_TOKEN }}
|
|
|
|
- name: login to DockerHub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: umputun
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
|
|
- name: free disk space
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf /usr/local/share/boost
|
|
docker system prune -af
|
|
|
|
- name: build and push to ghcr.io by digest
|
|
id: build-ghcr
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
platforms: ${{ matrix.platform }}
|
|
cache-from: type=gha,scope=${{ matrix.platform }}
|
|
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
|
|
build-args: |
|
|
SKIP_BACKEND_TEST=true
|
|
SKIP_FRONTEND_TEST=true
|
|
CI=github
|
|
GITHUB_SHA=${{ github.event.workflow_run.head_sha }}
|
|
GIT_BRANCH=${{ github.event.workflow_run.head_branch }}
|
|
GITHUB_REF=refs/heads/${{ github.event.workflow_run.head_branch }}
|
|
outputs: type=image,name=ghcr.io/umputun/remark42,push-by-digest=true,name-canonical=true,push=true
|
|
|
|
- name: build and push to DockerHub by digest
|
|
id: build-dockerhub
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
platforms: ${{ matrix.platform }}
|
|
cache-from: type=gha,scope=${{ matrix.platform }}
|
|
build-args: |
|
|
SKIP_BACKEND_TEST=true
|
|
SKIP_FRONTEND_TEST=true
|
|
CI=github
|
|
GITHUB_SHA=${{ github.event.workflow_run.head_sha }}
|
|
GIT_BRANCH=${{ github.event.workflow_run.head_branch }}
|
|
GITHUB_REF=refs/heads/${{ github.event.workflow_run.head_branch }}
|
|
outputs: type=image,name=umputun/remark42,push-by-digest=true,name-canonical=true,push=true
|
|
|
|
- name: export digests
|
|
run: |
|
|
mkdir -p /tmp/digests/ghcr /tmp/digests/dockerhub
|
|
digest_ghcr="${{ steps.build-ghcr.outputs.digest }}"
|
|
digest_dockerhub="${{ steps.build-dockerhub.outputs.digest }}"
|
|
touch "/tmp/digests/ghcr/${digest_ghcr#sha256:}"
|
|
touch "/tmp/digests/dockerhub/${digest_dockerhub#sha256:}"
|
|
|
|
- name: upload ghcr digest
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: digests-ghcr-${{ matrix.artifact }}
|
|
path: /tmp/digests/ghcr/*
|
|
retention-days: 1
|
|
|
|
- name: upload dockerhub digest
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: digests-dockerhub-${{ matrix.artifact }}
|
|
path: /tmp/digests/dockerhub/*
|
|
retention-days: 1
|
|
|
|
merge:
|
|
name: Create multi-arch manifest
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: download ghcr digests
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
path: /tmp/digests/ghcr
|
|
pattern: digests-ghcr-*
|
|
merge-multiple: true
|
|
|
|
- name: download dockerhub digests
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
path: /tmp/digests/dockerhub
|
|
pattern: digests-dockerhub-*
|
|
merge-multiple: true
|
|
|
|
- name: verify all digests present
|
|
run: |
|
|
expected=2
|
|
for registry in ghcr dockerhub; do
|
|
actual=$(find /tmp/digests/$registry -maxdepth 1 -type f | wc -l)
|
|
if [ "$actual" -ne "$expected" ]; then
|
|
echo "Expected $expected digests for $registry, found $actual"
|
|
ls -la /tmp/digests/$registry
|
|
exit 1
|
|
fi
|
|
done
|
|
echo "All digests present for both registries"
|
|
|
|
- name: set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: login to ghcr.io
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.PKG_TOKEN }}
|
|
|
|
- name: login to DockerHub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: umputun
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
|
|
- name: create ghcr.io manifest and push
|
|
working-directory: /tmp/digests/ghcr
|
|
env:
|
|
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
|
run: |
|
|
if [[ "$HEAD_BRANCH" == v* ]]; then
|
|
docker buildx imagetools create \
|
|
-t ghcr.io/umputun/remark42:${HEAD_BRANCH} \
|
|
-t ghcr.io/umputun/remark42:latest \
|
|
$(printf 'ghcr.io/umputun/remark42@sha256:%s ' *)
|
|
else
|
|
docker buildx imagetools create \
|
|
-t ghcr.io/umputun/remark42:${HEAD_BRANCH} \
|
|
$(printf 'ghcr.io/umputun/remark42@sha256:%s ' *)
|
|
fi
|
|
|
|
- name: create DockerHub manifest and push
|
|
working-directory: /tmp/digests/dockerhub
|
|
env:
|
|
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
|
run: |
|
|
if [[ "$HEAD_BRANCH" == v* ]]; then
|
|
docker buildx imagetools create \
|
|
-t umputun/remark42:${HEAD_BRANCH} \
|
|
-t umputun/remark42:latest \
|
|
$(printf 'umputun/remark42@sha256:%s ' *)
|
|
else
|
|
docker buildx imagetools create \
|
|
-t umputun/remark42:${HEAD_BRANCH} \
|
|
$(printf 'umputun/remark42@sha256:%s ' *)
|
|
fi
|
|
|
|
deploy:
|
|
name: Deploy to remark42.com
|
|
runs-on: ubuntu-latest
|
|
needs: merge
|
|
if: github.event.workflow_run.head_branch == 'master'
|
|
permissions: {} # only calls an external URL via curl, no GitHub API access needed
|
|
|
|
steps:
|
|
- name: trigger deployment
|
|
env:
|
|
UPDATER_KEY: ${{ secrets.UPDATER_KEY }}
|
|
run: curl -sf https://jess.umputun.com/update/remark42-core/${UPDATER_KEY}
|