Skip to content

update .github/actions #27

update .github/actions

update .github/actions #27

name: Publish Docker
on:
release:
types: [published]
push:
branches:
- main
paths-ignore:
- website/**
- .github/workflows/publish-website.yaml
- README.md
pull_request:
branches:
- main
paths-ignore:
- website/**
- .github/workflows/publish-website.yaml
- README.md
env:
REGISTRY: ghcr.io
defaults:
run:
shell: bash
jobs:
build-controller:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
env:
IMAGE_NAME: ${{ github.repository }}/controller
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build Docker image
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: .
file: build/controller/Dockerfile
cache-from: |
type=gha,scope=sha-${{ github.sha }}/controller
type=gha,scope=${{ github.ref_name }}/controller
type=gha,scope=${{ github.base_ref || 'main' }}/controller
type=gha,scope=main/controller
cache-to: |
type=gha,scope=sha-${{ github.sha }}/controller,mode=max
type=gha,scope=${{ github.ref_name }}/controller,mode=max
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-webhook:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
env:
IMAGE_NAME: ${{ github.repository }}/webhook
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build Docker image
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
context: .
file: build/webhook/Dockerfile
cache-from: |
type=gha,scope=sha-${{ github.sha }}/webhook
type=gha,scope=${{ github.ref_name }}/webhook
type=gha,scope=${{ github.base_ref || 'main' }}/webhook
type=gha,scope=main/webhook
cache-to: |
type=gha,scope=sha-${{ github.sha }}/webhook,mode=max
type=gha,scope=${{ github.ref_name }}/webhook,mode=max
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}