2020-10-14 23:58:10 +00:00
|
|
|
name: Docker
|
|
|
|
|
2024-04-19 01:42:01 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-10-14 23:58:10 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-09-15 17:30:17 +00:00
|
|
|
- main
|
|
|
|
- master
|
2020-10-14 23:58:10 +00:00
|
|
|
|
|
|
|
# Publish `v1.2.3` tags as releases.
|
|
|
|
tags:
|
2023-09-15 17:30:17 +00:00
|
|
|
- v*
|
2021-10-22 02:49:10 +00:00
|
|
|
pull_request:
|
2020-10-14 23:58:10 +00:00
|
|
|
|
|
|
|
env:
|
2021-10-22 02:49:10 +00:00
|
|
|
REGISTRY: ghcr.io
|
2022-07-13 19:14:49 +00:00
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
2020-10-14 23:58:10 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
push:
|
2021-10-22 04:09:41 +00:00
|
|
|
permissions:
|
|
|
|
packages: write
|
|
|
|
contents: read
|
2020-10-14 23:58:10 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check out code into the Go module directory
|
2024-11-05 05:57:45 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2020-10-14 23:58:10 +00:00
|
|
|
|
2021-10-22 02:49:10 +00:00
|
|
|
# Extract metadata (tags, labels) for Docker
|
|
|
|
# https://github.com/docker/metadata-action
|
|
|
|
- name: Extract Docker metadata
|
|
|
|
id: meta
|
2024-02-07 02:00:16 +00:00
|
|
|
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
|
2021-10-22 02:49:10 +00:00
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
2022-07-13 19:14:49 +00:00
|
|
|
|
|
|
|
# This action can be useful if you want to add emulation
|
|
|
|
# support with QEMU to be able to build against more platforms.
|
|
|
|
- name: Set up QEMU
|
2024-08-05 06:24:06 +00:00
|
|
|
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
|
2022-07-13 19:14:49 +00:00
|
|
|
|
|
|
|
# This action will create and boot a builder using
|
|
|
|
# by default the docker-container builder driver.
|
|
|
|
# Recommended for build multi-platform images, export cache, etc.
|
|
|
|
- name: Set up Docker Buildx
|
2024-10-06 17:35:34 +00:00
|
|
|
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
|
2022-07-13 19:14:49 +00:00
|
|
|
|
2021-10-22 04:09:41 +00:00
|
|
|
- name: Log into ${{ env.REGISTRY }}
|
|
|
|
if: github.event_name != 'pull_request'
|
2024-08-05 06:24:06 +00:00
|
|
|
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
2021-10-22 04:09:41 +00:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2021-10-22 02:49:10 +00:00
|
|
|
|
|
|
|
# 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
|
2024-10-06 17:35:34 +00:00
|
|
|
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
|
2021-10-22 02:49:10 +00:00
|
|
|
with:
|
2024-12-03 00:25:19 +00:00
|
|
|
platforms: linux/amd64,linux/arm64,linux/ppc64le
|
2021-10-22 02:49:10 +00:00
|
|
|
context: .
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|