Skip to content

Merge pull request #34 from GiganticMinecraft/KisaragiEffective-patch-1 #32

Merge pull request #34 from GiganticMinecraft/KisaragiEffective-patch-1

Merge pull request #34 from GiganticMinecraft/KisaragiEffective-patch-1 #32

Workflow file for this run

name: Build and publish cloudflared-with-auto-dns-route docker image
on:
push:
branches:
- main
paths:
- 'image-definition/**'
- '.github/workflows/publish.yml'
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
image_name: cloudflared-with-auto-dns-route
steps:
- name: Checkout code
uses: actions/checkout@master
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: extract_cloudflared_image_tag
run: |
image_tag="$(grep -P -o "(?<=^FROM cloudflare/cloudflared\:)([0-9]+\.[0-9]+\.[0-9]+)" image-definition/Dockerfile)"
echo "::set-output name=image_tag::${image_tag}"
# Docker does not allow uppercase letters for image name, so we must replace repository_owner and so on
- id: prepare_image_id
name: Prepare image id's components
run: |
lowercase_id=ghcr.io/${{ github.repository_owner }}/${{ env.image_name }}
echo "::set-output name=lowercase_id::$(echo $lowercase_id | tr '[A-Z]' '[a-z]')"
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ steps.prepare_image_id.outputs.lowercase_id }}
tags: |
type=sha
type=raw,value=${{ steps.extract_cloudflared_image_tag.outputs.image_tag }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./image-definition
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}