Skip to content

Prep work for next version #87

Prep work for next version

Prep work for next version #87

Workflow file for this run

name: Publish Docker image to GHCR
on:
pull_request:
branches: [main]
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-push:
# Only run for PRs from the same repository (not forks)
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up QEMU (for multi-arch)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
secrets: |
"public_github_token=${{ secrets.PUBLIC_GITHUB_TOKEN }}"
tags: |
ghcr.io/${{ github.repository_owner }}/studiocms-docs:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/studiocms-docs:pr-${{ github.event.pull_request.number }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/studiocms-docs-pr:cache
cache-to: type=inline
- name: Verify pushed image
run: |
echo "Pushed: ghcr.io/${{ github.repository_owner }}/studiocms-docs:${{ github.sha }}"
echo "Pushed: ghcr.io/${{ github.repository_owner }}/studiocms-docs:pr-${{ github.event.pull_request.number }}"