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
|
|
|
|
workflow_dispatch:
|
2022-06-28 16:13:00 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-23 14:14:09 +02:00
|
|
|
version: [20.13.1-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
|
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
|
|
|
|
tags: |
|
2024-05-24 09:28:39 +02:00
|
|
|
# only enabled for workflow dispatch except main (assume its a release):
|
|
|
|
type=semver,pattern={{ version }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
|
|
|
|
type=semver,pattern={{ major }}.{{ minor }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
|
|
|
|
type=semver,pattern={{ major }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},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 }}
|
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
|
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 }}
|