Skip to content

feat: CP 2.2.0 + Alpine 3.20 + PHP 8.2 #3

feat: CP 2.2.0 + Alpine 3.20 + PHP 8.2

feat: CP 2.2.0 + Alpine 3.20 + PHP 8.2 #3

Workflow file for this run

name: CI
on:
push:
tags: [ '*.*.*-r*' ]
pull_request:
branches: [ master ]
env:
REGISTRY: registry.hub.docker.com
IMAGE_NAME: marverix/classicpress
BUILD_CONTEXT: ./classicpress
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: |
tag=${GITHUB_REF/refs\/tags\//}
version=$(echo "${tag}" | egrep -o "[0-9]+\.[0-9]+\.[0-9]+")
echo "::set-output name=value::${version}"
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
# - name: Install cosign
# if: github.event_name != 'pull_request'
# uses: sigstore/cosign-installer@main
# with:
# cosign-release: 'v2.0.1'
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/[email protected]
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PTA }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=match,pattern=(\d+\.\d+),group=1
type=match,pattern=\d+\.\d+
type=match,pattern=([^-]+),group=1
type=match,pattern=[^-]+
type=match,pattern=.+
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
build-args: |
version=${{ steps.get_version.outputs.value }}
context: ${{ env.BUILD_CONTEXT }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
- name: Update Docker Hub description
if: ${{ github.event_name != 'pull_request' }}
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
repository: ${{ env.IMAGE_NAME }}
short-description: ClassicPress Docker Image