Merge pull request #501 from openziti/500-page-counts #106
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 Console Image to Docker Hub | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
# Publish semver tags as releases. | |
- app-ziti-console-v*.*.* | |
env: | |
REGISTRY: docker.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ vars.ZITI_CONSOLE_IMAGE_NAME || 'openziti/ziti-console-assets' }} | |
# oldest, supported, compatible LTS (even numbered Node versions); defines the source image version used to build the | |
# ziti-console container image | |
NODE_VERSION: 20 | |
jobs: | |
docker-build-push: | |
name: Push SPA Image to Docker Hub | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
id-token: write | |
attestations: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Login against a Docker registry | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY}} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY}} | |
username: ${{ vars.DOCKER_HUB_API_USER || secrets.DOCKER_HUB_API_USER }} | |
password: ${{ secrets.DOCKER_HUB_API_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Define Docker Tags | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY}}/${{ env.IMAGE_NAME }} | |
tags: | | |
# set "main" tag on revisions that are accepted into the default branch | |
type=raw,value=${{ github.ref_name }},enable={{is_default_branch}} | |
# set "latest" tag on releases | |
type=raw,value=latest,enable=${{startsWith(github.ref_name, 'app-ziti-console-v')}} | |
# set (e.g., "1.2.3") semver tag on releases | |
type=match,pattern=app-ziti-console-v(.*),group=1,enable=${{startsWith(github.ref_name, 'app-ziti-console-v')}} | |
# set (e.g., "v1") major version tag on releases | |
type=match,pattern=app-ziti-console-(v\d+)\..*,group=1,enable=${{startsWith(github.ref_name, 'app-ziti-console-v')}} | |
- name: Set Up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: amd64,arm64 | |
- name: Set Up Docker BuildKit | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# Build and push Docker image with Buildx | |
- name: Build and Push Docker Image | |
id: push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker-images/ziti-console-assets/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
# ziti controller always binds at /zac and trailing slash is necessary to qualify Angular runtime paths in index.html | |
build-args: | | |
NODE_VERSION=${{ env.NODE_VERSION }} | |
BASE_HREF=/zac/ | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.REGISTRY}}/${{ env.IMAGE_NAME}} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |