Skip to content

Publish container image #1239

Publish container image

Publish container image #1239

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
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Login to GitHub Container Registry
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.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
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Build and Push release
if: github.event_name != 'schedule'
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.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'
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.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 }}"