2023-02-08 17:40:27 +01:00
|
|
|
name: Publish Docker Images
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
zrok-version:
|
|
|
|
description: zrok release tag to publish as a Docker image
|
|
|
|
type: string
|
|
|
|
required: true
|
|
|
|
release:
|
|
|
|
types:
|
2023-08-09 15:39:20 +02:00
|
|
|
- released # excludes "prereleased" which is included in "published" to
|
|
|
|
# avoid prematurely releasing semver tagged container images
|
2023-02-08 17:40:27 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-docker-images:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
RELEASE_REF: ${{ inputs.zrok-version || github.ref }}
|
|
|
|
steps:
|
|
|
|
# compose the semver string without leading "refs/tags" or "v" so we can predict the
|
|
|
|
# release artifact filename
|
|
|
|
- name: Set zrok Version Semver from Tag Ref
|
|
|
|
id: semver
|
|
|
|
run: |
|
|
|
|
zrok_semver=${RELEASE_REF#refs/tags/}
|
2023-10-31 21:42:00 +01:00
|
|
|
echo "zrok_semver=${zrok_semver#v}" | tee -a $GITHUB_OUTPUT
|
2023-02-08 17:40:27 +01:00
|
|
|
|
|
|
|
- name: Checkout Workspace
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Create the Release Arch Dirs
|
|
|
|
run: |
|
|
|
|
for TGZ in dist/{amd,arm}64/linux/; do
|
|
|
|
mkdir -pv ${TGZ}
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Download Linux AMD64 Release Artifact
|
|
|
|
uses: dsaltares/fetch-gh-release-asset@master
|
|
|
|
with:
|
|
|
|
version: tags/v${{ steps.semver.outputs.zrok_semver }}
|
|
|
|
file: zrok_${{ steps.semver.outputs.zrok_semver }}_linux_amd64.tar.gz
|
|
|
|
target: dist/amd64/linux/zrok_${{ steps.semver.outputs.zrok_semver }}_linux_amd64.tar.gz
|
|
|
|
|
|
|
|
- name: Download Linux ARM64 Release Artifact
|
|
|
|
uses: dsaltares/fetch-gh-release-asset@master
|
|
|
|
with:
|
|
|
|
version: tags/v${{ steps.semver.outputs.zrok_semver }}
|
|
|
|
file: zrok_${{ steps.semver.outputs.zrok_semver }}_linux_arm64.tar.gz
|
|
|
|
target: dist/arm64/linux/zrok_${{ steps.semver.outputs.zrok_semver }}_linux_arm64.tar.gz
|
|
|
|
|
|
|
|
- name: Unpack the Release Artifacts
|
|
|
|
run: |
|
|
|
|
for TGZ in dist/{amd,arm}64/linux; do
|
|
|
|
tar -xvzf ${TGZ}/zrok_*.tar.gz -C ${TGZ}
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Set Up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
with:
|
|
|
|
platforms: amd64,arm64
|
|
|
|
|
|
|
|
- name: Set Up Docker BuildKit
|
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
2023-10-31 21:42:00 +01:00
|
|
|
username: ${{ vars.DOCKER_HUB_API_USER || secrets.DOCKER_HUB_API_USER }}
|
2023-02-08 17:40:27 +01:00
|
|
|
password: ${{ secrets.DOCKER_HUB_API_TOKEN }}
|
|
|
|
|
|
|
|
- name: Set Up Container Image Tags for zrok CLI Container
|
|
|
|
env:
|
|
|
|
RELEASE_REPO: openziti/zrok
|
|
|
|
ZROK_VERSION: ${{ steps.semver.outputs.zrok_semver }}
|
|
|
|
id: tagprep_cli
|
|
|
|
run: |
|
2023-10-31 21:42:00 +01:00
|
|
|
echo DOCKER_TAGS="${RELEASE_REPO}:${ZROK_VERSION},${RELEASE_REPO}:latest" | tee -a $GITHUB_OUTPUT
|
2023-02-08 17:40:27 +01:00
|
|
|
|
|
|
|
# this is the CLI image with the Linux binary for each
|
|
|
|
# arch that was downloaded in ./dist/
|
|
|
|
- name: Build & Push Multi-Platform CLI Container Image to Hub
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
context: ${{ github.workspace }}/
|
2023-02-21 16:28:54 +01:00
|
|
|
file: ${{ github.workspace }}/docker/images/zrok/Dockerfile
|
2023-02-08 17:40:27 +01:00
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
tags: ${{ steps.tagprep_cli.outputs.DOCKER_TAGS }}
|
|
|
|
build-args: |
|
2023-02-21 16:28:54 +01:00
|
|
|
DOCKER_BUILD_DIR=./docker/images/zrok
|
2023-02-08 17:40:27 +01:00
|
|
|
ARTIFACTS_DIR=./dist
|
|
|
|
push: true
|