Skip to content

Workflow file for this run

---
name: Build and publish container image
on:
release:
types:
- published
workflow_dispatch:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
REPO_NAME: mattkobayashi
IMAGE_NAME: fuelhook
jobs:
create-runner:
name: Create self-hosted Actions runner
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runner-name: [
fuelhook
]
steps:
- name: Create self-hosted Actions runner
uses: MattKobayashi/[email protected]
with:
gh-app-id: ${{ secrets.GH_APP_ID }}
gh-app-login: MattKobayashi
gh-app-private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
runner-network: mattflix
ssh-host: 100.102.37.118
ssh-user: matthew
ts-oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
ts-oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
ts-tag: ci
build-publish:
name: Build and publish container image
runs-on: self-hosted
needs: [create-runner]
permissions:
contents: read
packages: write
steps:
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/[email protected]
# Set up Docker Buildx
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["registry-mirror:5000"]
[registry."registry-mirror:5000"]
http = true
driver-opts: |
network=mattflix
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract container metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern=v{{version}},event=tag
type=semver,pattern=v{{major}}.{{minor}},event=tag
type=semver,pattern=v{{major}},event=tag
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push container image
uses: docker/[email protected]
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max