-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (70 loc) · 2.25 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Publish
on:
workflow_dispatch:
inputs:
tag:
description: "Image tag"
required: true
default: "latest"
type: string
server-tag:
description: "Target image tag for sharinghub-server"
required: true
default: "latest"
type: string
ui-tag:
description: "Target image tag for sharinghub-ui"
required: true
default: "latest"
type: string
docs-tag:
description: "Target image tag for sharinghub-docs"
required: true
default: "latest"
type: string
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
env:
IMAGE_NAME: ${{ github.event.repository.name }}
IMAGE_TAG: ${{ inputs.tag || github.ref_name }}
IMAGE_SERVER_TAG: ${{ inputs.server-tag || github.ref_name }}
IMAGE_UI_TAG: ${{ inputs.ui-tag || github.ref_name }}
IMAGE_DOCS_TAG: ${{ inputs.docs-tag || github.ref_name }}
jobs:
docker-build-and-push:
name: Build and push docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login with registry
uses: docker/login-action@v3
with:
registry: ${{ vars.IMAGE_REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.IMAGE_REPOSITORY }}/${{ env.IMAGE_NAME }}
tags: |
# set image tag
type=raw,value=${{ env.IMAGE_TAG }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
build-args: |
SERVER_IMAGE=${{ vars.IMAGE_REPOSITORY }}/sharinghub-server:${{ env.IMAGE_SERVER_TAG }}
WEB_UI_IMAGE=${{ vars.IMAGE_REPOSITORY }}/sharinghub-ui:${{ env.IMAGE_UI_TAG }}
DOCS_IMAGE=${{ vars.IMAGE_REPOSITORY }}/sharinghub-docs:${{ env.IMAGE_DOCS_TAG }}
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
provenance: mode=max
sbom: true
push: true