2023-06-05 14:34:22 +02:00
|
|
|
name: Publish to dockerhub
|
2022-06-28 16:13:00 +02:00
|
|
|
|
2025-01-16 10:34:14 +01:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-06-28 16:13:00 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-07-05 14:29:37 +02:00
|
|
|
paths-ignore:
|
|
|
|
- website/**
|
2024-05-24 09:28:39 +02:00
|
|
|
workflow_call:
|
2023-06-12 09:15:09 +02:00
|
|
|
inputs:
|
2024-05-24 09:28:39 +02:00
|
|
|
version:
|
|
|
|
description: "Which version to release"
|
2025-01-16 10:29:07 +01:00
|
|
|
type: "string"
|
2024-05-24 09:28:39 +02:00
|
|
|
required: true
|
2024-08-22 12:01:34 +02:00
|
|
|
is-latest-version:
|
|
|
|
description: Is this the latest version? If latest we'll update the version docker
|
|
|
|
required: true
|
|
|
|
type: boolean
|
|
|
|
default: true
|
2024-05-24 09:28:39 +02:00
|
|
|
workflow_dispatch:
|
2022-06-28 16:13:00 +02:00
|
|
|
|
2025-01-16 10:31:19 +01:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
|
|
|
contents: read
|
|
|
|
|
2022-06-28 16:13:00 +02:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2025-01-16 10:29:07 +01:00
|
|
|
version: [20.18.1-alpine]
|
2022-06-28 16:13:00 +02:00
|
|
|
steps:
|
2024-06-04 12:00:00 +02:00
|
|
|
- name: Checkout tag v${{ inputs.version }}
|
|
|
|
if: ${{ inputs.version != '' }}
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: v${{ inputs.version }} # tag that should be created by the caller workflow
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Checkout
|
2024-06-04 12:00:00 +02:00
|
|
|
if: ${{ inputs.version == '' }}
|
2023-10-05 10:19:57 +02:00
|
|
|
uses: actions/checkout@v4
|
2025-01-16 10:29:07 +01:00
|
|
|
- name: Configure AWS credentials
|
|
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::726824350591:role/unleash-github-ecr-public-publish-role
|
2025-01-16 10:34:14 +01:00
|
|
|
role-session-name: unleash-actions-push-to-ecr-public
|
2025-01-16 10:29:07 +01:00
|
|
|
aws-region: us-east-1
|
|
|
|
- name: Login to AWS ECR
|
|
|
|
id: login-ecr-public
|
|
|
|
uses: aws-actions/amazon-ecr-login@v2
|
|
|
|
with:
|
|
|
|
registry-type: public
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Setup QEmu so we can build multiplatform
|
2024-06-27 15:07:25 +02:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Setup Docker buildx
|
2024-07-30 10:43:56 +02:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Docker meta configuration
|
2024-04-10 11:10:10 +02:00
|
|
|
uses: docker/metadata-action@v5
|
2022-06-28 16:13:00 +02:00
|
|
|
id: meta
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
unleashorg/unleash-server
|
2025-01-16 10:29:07 +01:00
|
|
|
public.ecr.aws/unleashorg/unleash-server
|
2024-08-22 12:45:18 +02:00
|
|
|
flavor: latest=${{ github.event.inputs.is-latest-version || 'auto' }}
|
2022-06-28 16:13:00 +02:00
|
|
|
tags: |
|
2024-05-24 09:28:39 +02:00
|
|
|
# only enabled for workflow dispatch except main (assume its a release):
|
2024-12-13 14:24:22 +01:00
|
|
|
type=semver,pattern={{ version }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }},value=${{ inputs.version }}
|
|
|
|
type=semver,pattern={{ major }}.{{ minor }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }},value=${{ inputs.version }}
|
|
|
|
type=semver,pattern={{ major }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }},value=${{ inputs.version }}
|
2023-06-05 14:34:22 +02:00
|
|
|
# only enabled in main:
|
2024-12-20 09:45:22 +01:00
|
|
|
type=edge,prefix=main-,enable=${{ github.ref == 'refs/heads/main' }}
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Login to docker hub
|
2024-04-10 11:09:48 +02:00
|
|
|
uses: docker/login-action@v3
|
2022-06-28 16:13:00 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build tag and push image to Docker hub
|
2024-07-09 16:01:05 +02:00
|
|
|
uses: docker/build-push-action@v6
|
2022-06-28 16:13:00 +02:00
|
|
|
with:
|
2023-06-12 09:15:09 +02:00
|
|
|
context: .
|
2022-06-28 16:13:00 +02:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2024-05-24 09:28:39 +02:00
|
|
|
push: true
|
2022-06-28 16:13:00 +02:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
build-args: NODE_VERSION=${{ matrix.version }}
|
2024-09-19 14:55:32 +02:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|