2023-06-05 14:34:22 +02:00
|
|
|
name: Publish to dockerhub
|
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"
|
|
|
|
type: 'string'
|
|
|
|
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
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-06-27 12:52:43 +02:00
|
|
|
version: [ 20.14.0-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
|
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
|
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:
|
|
|
|
type=edge,prefix=main-,suffix=-${{ matrix.version }},enable=${{ github.ref == 'refs/heads/main' }}
|
2023-06-12 09:15:09 +02:00
|
|
|
# only enabled on workflow_dispatch:
|
|
|
|
type=sha,suffix=-${{ matrix.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
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
|