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/**
|
2023-06-05 14:34:22 +02:00
|
|
|
tags:
|
|
|
|
- 'v*'
|
2023-06-12 09:15:09 +02:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
ignore-push:
|
|
|
|
description: 'Ignore push to dockerhub. If not set the image will be pushed with the sha of the commit as tag'
|
|
|
|
required: false
|
|
|
|
type: boolean
|
2022-06-28 16:13:00 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-10-26 09:09:03 +02:00
|
|
|
version: [18.18.2-alpine]
|
2022-06-28 16:13:00 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
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
|
2022-07-11 14:01:26 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Setup Docker buildx
|
2022-07-11 14:01:04 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Docker meta configuration
|
2022-06-29 09:36:09 +02:00
|
|
|
uses: docker/metadata-action@v4
|
2022-06-28 16:13:00 +02:00
|
|
|
id: meta
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
unleashorg/unleash-server
|
|
|
|
tags: |
|
2023-06-05 14:34:22 +02:00
|
|
|
# only enabled for v* tags:
|
|
|
|
type=semver,pattern={{ version }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
|
|
type=semver,pattern={{ major.minor }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
|
|
type=semver,pattern={{ major }},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
|
|
# 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 }}
|
2023-06-12 09:15:09 +02:00
|
|
|
- name: Build frontend
|
|
|
|
run: |
|
|
|
|
yarn --cwd ./frontend install
|
|
|
|
yarn build:frontend
|
2022-06-28 16:13:00 +02:00
|
|
|
- name: Build tag and push image to Docker hub
|
2024-04-10 11:09:28 +02:00
|
|
|
uses: docker/build-push-action@v5
|
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
|
2023-06-12 09:15:09 +02:00
|
|
|
push: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.ignore-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 }}
|