Skip to content

Publish container image #1177

Publish container image

Publish container image #1177

Workflow file for this run

---
name: Publish container image
on:
workflow_dispatch:
release:
types:
- created
schedule:
- cron: 00 00 * * *
permissions:
contents: read
jobs:
docker:
permissions:
# for docker/build-push-action to publish docker image
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Docker Buildx
# yamllint disable-line rule:line-length
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Login to GitHub Container Registry
# yamllint disable-line rule:line-length
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set tag for image
run: >-
echo IMAGE_TAG=$(
[ ${{ github.ref_type }} == 'tag' ]
&& echo ${{ github.ref_name }}
|| echo 'latest'
) >> $GITHUB_ENV
- name: Set IMAGE_REPO environment variable
# Lowercase the org/repo name to allow for workflow to run in forks,
# which owners have uppercase letters in username
run: >-
echo "IMAGE_REPO=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
- name: Set up Docker Buildx
# yamllint disable-line rule:line-length
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Build and Push release
if: github.event_name != 'schedule'
# yamllint disable-line rule:line-length
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
context: .
build-args: |
INSTALL_ALL=true
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_REPO }}:${{ env.IMAGE_TAG }}
${{ env.IMAGE_REPO }}:latest
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"
- name: Build and Push nightly
if: github.event_name == 'schedule'
# yamllint disable-line rule:line-length
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
context: .
build-args: |
INSTALL_ALL=true
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_REPO }}:nightly
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"