rename env to DOCKERFILE_CONTEXT #20
Workflow file for this run
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
--- | |
# Automatically build and publish the client to the container registry. | |
# This workflow is triggered on changes to the client directory. | |
name: Build and Publish hmi-client | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
#paths: ['packages/client/**'] | |
branches: ['use-mac-os-to-build-arm-images'] #, 'main'] | |
tags: ['*'] | |
env: | |
REGISTRY: ghcr.io | |
DOCKERFILE_CONTEXT: packages/client/hmi-client/docker | |
jobs: | |
set-tag: | |
name: Create and Set Tag | |
runs-on: ubuntu-22.04 | |
outputs: | |
image: ${{ steps.define-tag.outputs.image }} | |
steps: | |
- name: Define Tag | |
id: define-tag | |
run: | | |
if [[ '${{ github.ref_type }}' == 'branch' && '${{ github.ref_name }}' == 'main' ]]; then | |
TAG=latest | |
else | |
SEMVER=$( echo ${{ github.ref_name }} | sed -nre 's/^v[^0-9]*(([0-9]+\.)*[0-9]+(-[a-z]+)?).*/\1/p') | |
if [[ -n $SEMVER ]]; then | |
TAG=${SEMVER} | |
else | |
TAG=${{ github.ref_name }} | |
fi | |
fi | |
TAG=test-to-be-deleted | |
IMAGE=${{ env.REGISTRY }}/darpa-askem/hmi-client:${TAG,,} | |
echo "$IMAGE" | |
echo "image=$IMAGE" >> $GITHUB_OUTPUT | |
amd64: | |
runs-on: ubuntu-22.04 | |
needs: set-tag | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Name of the image | |
run: echo ${{ needs.set-tag.outputs.image }} | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node 20.10.0 LTS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Build image using Makefile | |
run: make image-hmi-client | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ env.DOCKERFILE_CONTEXT }} | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ needs.set-tag.outputs.image }}--amd64 | |
arm64-macos: | |
if: false | |
# Disabled until macOS GitHub runners uses M2 that can do nested virtualization | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#limitations-for-arm64-macos-runners | |
runs-on: macos-14 | |
needs: set-tag | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Setup Docker on macOS | |
uses: douglascamata/setup-docker-macos-action@v1-alpha | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Build image using Makefile | |
run: make image-hmi-client | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ env.DOCKERFILE_CONTEXT }} | |
platforms: linux/arm64 | |
push: true | |
tags: ${{ needs.set-tag.outputs.image }}--arm64 | |
arm64-emulation: | |
if: false | |
runs-on: ubuntu-22.04 | |
needs: set-tag | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Login to registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Node 20.10.0 LTS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.0 | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Build image using Makefile | |
run: make image-hmi-client | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ env.DOCKERFILE_CONTEXT }} | |
platforms: linux/arm64 | |
push: true | |
tags: ${{ needs.set-tag.outputs.image }}--arm64 |