Publish to Docker Hub (Manual) #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to Docker Hub (Manual) | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Git Reference | |
default: master | |
required: true | |
tag: | |
description: Docker Tag | |
default: daily | |
required: true | |
release: | |
description: Release Channel | |
default: dev | |
required: true | |
version: | |
description: Application Version | |
default: "0.0.0.0" | |
required: true | |
jobs: | |
docker-manual-build: | |
name: Publish docker image | |
strategy: | |
matrix: | |
include: | |
- arch: 'amd64' | |
dockerfile: 'Dockerfile' | |
- arch: 'arm64' | |
dockerfile: 'Dockerfile.aarch64' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
ref: "${{ github.event.inputs.ref }}" | |
submodules: recursive | |
fetch-depth: 0 # This is set to download the full git history for the repo | |
- name: Replace Sentry DSN and other keys | |
shell: pwsh | |
run: | | |
./.github/workflows/ReplaceSentryDSN.ps1 -dsn ${{ secrets.SENTRY_DSN }} | |
./.github/workflows/ReplaceAVD3URL.ps1 -url ${{ secrets.AVD3_URL }} | |
- uses: docker/setup-qemu-action@v2 | |
name: Set up QEMU | |
with: | |
platforms: arm64 | |
if: ${{ matrix.arch == 'arm64' }} | |
- uses: docker/setup-buildx-action@v2 | |
name: Set up Docker Buildx | |
- uses: docker/login-action@v2 | |
name: Log into GitHub Container Registry | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/login-action@v2 | |
name: Log into Docker Hub | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Retrieve Commit Date | |
id: version | |
run: | | |
echo "COMMIT_DATE=$(git log -1 --format="%aI")" >> $GITHUB_OUTPUT | |
# Disabled provenance for now, until it works with docker manifest create. | |
# The manifest list produced by the new feature is incompatible with the | |
# expected format used in the docker manifest create command. | |
- uses: docker/build-push-action@v4 | |
name: Build and Push the Docker image | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
tags: | | |
ghcr.io/${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }}-${{ matrix.arch }} | |
${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }}-${{ matrix.arch }} | |
platforms: linux/${{ matrix.arch }} | |
build-args: | | |
version=${{ github.event.inputs.version }} | |
channel=${{ github.event.inputs.release }} | |
commit=${{ github.sha }} | |
date=${{ steps.version.outputs.COMMIT_DATE }} | |
provenance: false | |
docker-manual-push_manifest: | |
needs: docker-manual-build | |
name: Push combined tag for both images | |
runs-on: ubuntu-latest | |
steps: | |
- uses: docker/login-action@v2 | |
name: Log into GitHub Container Registry | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/login-action@v2 | |
name: Log into Docker Hub | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Create manifest | |
run: | | |
docker manifest create ghcr.io/${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }} --amend ghcr.io/${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }}-amd64 --amend ghcr.io/${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }}-arm64 | |
docker manifest create ${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }} --amend ${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }}-amd64 --amend ${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }}-arm64 | |
- name: Push manifest | |
run: | | |
docker manifest push ghcr.io/${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }} | |
docker manifest push ${{ secrets.DOCKER_REPO }}:${{ github.event.inputs.tag }} |