Merge pull request #3 from skyblaster/renovate/caddy-2.x #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OCI Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
IMAGE_NAME: caddy-cloudflaredns | |
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
REGISTRY_USER: ${{ github.actor }} | |
REGISTRY_PASSWORD: ${{ github.token }} | |
jobs: | |
push-ghcr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
# Checkout push-to-registry action github repository | |
- name: Checkout Push to Registry action | |
uses: actions/checkout@v4 | |
# Extract the tag from the Containerfile | |
- name: Get upstream tag | |
id: get_upstream_tag | |
run: | | |
UPSTREAM_TAG=$(grep -m 2 -oP '(?<=FROM caddy:)[^ ]+' Containerfile | tail -n 1) | |
echo "UPSTREAM_TAG=${UPSTREAM_TAG}" >> "$GITHUB_ENV" | |
# Build image using Buildah action | |
- name: Build Image | |
id: build_image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.IMAGE_NAME }} | |
tags: ${{ env.UPSTREAM_TAG }} latest | |
containerfiles: | | |
./Containerfile | |
# Push the image to GHCR (Image Registry) | |
- name: Push To GHCR | |
uses: redhat-actions/push-to-registry@v2 | |
id: push | |
with: | |
image: ${{ steps.build_image.outputs.image }} | |
tags: ${{ steps.build_image.outputs.tags }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
extra-args: | | |
--disable-content-trust |