Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/docker-publish-generic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: ASF-docker-publish-generic

on:
release:
types: [released]

env:
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: generic

permissions:
packages: write

jobs:
main:
environment: release-docker
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
show-progress: false
submodules: recursive

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

- name: Login to ghcr.io
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Prepare environment outputs
shell: sh
run: |
set -eu

echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
with:
# Only push releases to Docker Hub
images: |
ghcr.io/${{ env.GHCR_REPOSITORY }}
${{ env.DH_REPOSITORY }}
tags: |
# Matches 1.2.3.4 and outputs 1.2.3
type=match,pattern=^(\d+\.\d+\.\d+)\.\d+$,group=1
# Matches 1.2.3.4 and outputs 1.2
type=match,pattern=^(\d+\.\d+)\.\d+\.\d+$,group=1
# Matches 1.2.3.4 and outputs 1
type=match,pattern=^(\d+)\.\d+\.\d+\.\d+$,group=1
type=raw,value=${{ env.TAG }}
flavor: |
latest=false

- name: Build and publish Docker image from Dockerfile
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: .
platforms: ${{ env.PLATFORMS }}
provenance: true
sbom: true
secrets: |
ASF_PRIVATE_SNK=${{ secrets.ASF_PRIVATE_SNK }}
STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true