Files
freeCodeCamp/.github/workflows/docker-ghcr.yml
renovate[bot] e4f1e611b8 chore(deps): update github actions (major) (#65179)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-15 16:07:37 +00:00

61 lines
1.7 KiB
YAML

name: CD - Docker - GHCR (Gitpod)
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'docker/gitpod/*'
jobs:
build-and-push-image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
images:
- gitpod
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Log in to the GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.images }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.images }}-
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: ./docker/${{ matrix.images }}
push: true
tags: |
ghcr.io/freecodecamp/${{ matrix.images }}:${{ github.sha }}
ghcr.io/freecodecamp/${{ matrix.images }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache