Build and publish tag #92
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: Build and publish tag | |
on: | |
workflow_run: | |
workflows: ["Create tag on updated version"] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
folder: | |
- azure | |
- openid-connect | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- id: retrieve-version | |
name: Retrieve version | |
run: | | |
PACKAGE_VERSION=$(cat platforms/${{ matrix.folder }}/package.json \ | |
| grep unleash-server \ | |
| head -1 \ | |
| awk -F: '{ print $2 }' \ | |
| sed 's/[", ]//g') | |
MAJOR=$(echo $PACKAGE_VERSION | cut -d. -f1) | |
MINOR=$(echo $PACKAGE_VERSION | cut -d. -f2) | |
set -x | |
echo "::set-output name=version::${PACKAGE_VERSION}" | |
echo "::set-output name=major::${MAJOR}" | |
echo "::set-output name=minor::${MINOR}" | |
set +x | |
- name: Setup QEmu so we can build multiplatform | |
uses: docker/setup-qemu-action@v3 | |
- name: Login to docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker meta configuration | |
uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: | | |
unleashorg/unleash-community-${{ matrix.folder }} | |
tags: | | |
type=semver,pattern={{version}},value=${{ steps.retrieve-version.outputs.version }} | |
type=semver,pattern={{major}}.{{minor}},value=${{ steps.retrieve-version.outputs.major }}.${{ steps.retrieve-version.outputs.minor }} | |
type=semver,pattern={{major}},value=${{ steps.retrieve-version.outputs.major }} | |
- name: Build tag and push image to Docker hub | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
context: platforms/${{ matrix.folder }} | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
NODE_VERSION=20-alpine |