-
-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (58 loc) · 2.2 KB
/
publish-release.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
name: Publish Release
on:
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab with an optional version input
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., v1.2.3)'
required: true
concurrency:
group: "docker-publish-release"
cancel-in-progress: true
jobs:
# Job to determine the version based on the trigger
set-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- name: Determine Version
id: set-version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.version }}" != "" ]]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "Triggered manually with version: ${{ github.event.inputs.version }}"
elif [[ "${{ github.event_name }}" == "release" && "${{ startsWith(github.event.release.tag_name, 'release') }}" == "true" ]]; then
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
echo "Triggered by release with tag: ${{ github.event.release.tag_name }}"
else
echo "version=" >> $GITHUB_OUTPUT
echo "No valid version provided. Skipping publish-release job."
fi
publish-release:
needs: set-version
if: ${{ needs.set-version.outputs.version != '' }}
uses: ./.github/workflows/embedded-build-package.yml
with:
REGISTRY: "ghcr.io"
IMAGE_NAME: ${{ github.repository }}
IMAGE_VERSION: ${{ needs.set-version.outputs.version }}
secrets:
DOCKER_LOGIN: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.BUILD_USER_TOKEN }}
BUILD_USER_TOKEN: ${{ secrets.BUILD_USER_TOKEN }}
publish-latest:
uses: ./.github/workflows/embedded-build-package.yml
with:
REGISTRY: "ghcr.io"
IMAGE_NAME: ${{ github.repository }}
IMAGE_VERSION: "latest"
secrets:
DOCKER_LOGIN: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.BUILD_USER_TOKEN }}
BUILD_USER_TOKEN: ${{ secrets.BUILD_USER_TOKEN }}
update-beta:
uses: ./.github/workflows/publish-beta.yml
secrets: inherit