Skip to content

Install docker buildx #8

Install docker buildx

Install docker buildx #8

Workflow file for this run

---
# 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
REGISTRY_ORG: darpa-askem
jobs:
# amd64:
# runs-on: ubuntu-22.04
#
# permissions:
# contents: read
# packages: write
#
# steps:
# - name: Checkout the repository
# uses: actions/checkout@v4
#
# - name: Setup Node 20.10.0 LTS
# uses: actions/setup-node@v4
# with:
# node-version: 20.10.0
# cache: 'yarn'
#
# - name: Build image using Makefile
# run: make image-hmi-client
#
# - name: Login to registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: 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
# echo "$TAG"
# echo "TAG=${TAG,,}" >> ${GITHUB_ENV}
#
# - name: Build and push
# uses: docker/build-push-action@v5
# with:
# context: packages/client/hmi-client/docker
# platforms: linux/amd64
# push: true
# tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/hmi-client:${{ env.TAG }}--amd64
arm64:
runs-on: macos-14
permissions:
contents: read
packages: write
steps:
- name: Setup Docker & yarn
run: |
brew install \
docker \
yarn
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-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: 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
LOWER_TAG=$(echo "$TAG" | tr '[:upper:]' '[:lower:]')
echo "$LOWER_TAG"
echo "TAG=${LOWER_TAG}" >> ${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: packages/client/hmi-client/docker
platforms: linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_ORG }}/hmi-client:${{ env.TAG }}--arm64