Skip to content

Commit 5c4287a

Browse files
authored
Add a way to manually publish docker images based on an input tag (line#1226)
As a follow-up for: line#1221
1 parent 49126c2 commit 5c4287a

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

.github/workflows/publish-docker.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- centraldogma-*
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Target version x.y.z'
11+
required: true
12+
type: string
713

814
env:
915
LC_ALL: 'en_US.UTF-8'
@@ -16,7 +22,14 @@ jobs:
1622
if: github.repository == 'line/centraldogma'
1723
runs-on: ubuntu-latest
1824
steps:
19-
- name: Check out the repo
25+
- name: Check out tag from workflow_dispatch
26+
if: github.event_name == 'workflow_dispatch'
27+
uses: actions/checkout@v4
28+
with:
29+
ref: centraldogma-${{ github.event.inputs.version }}
30+
31+
- name: Check out tag on push
32+
if: github.event_name != 'workflow_dispatch'
2033
uses: actions/checkout@v4
2134

2235
- name: Set up JDK 25
@@ -38,12 +51,15 @@ jobs:
3851
id: release-version
3952
uses: actions/github-script@v4
4053
with:
41-
# Extract a release version from 'refs/tags/centraldogma-x.y.z' tag.
4254
script: |
43-
const version = context.ref.replace(/.*centraldogma-/, '')
44-
console.log('Release version: ' + version)
45-
return version
46-
result-encoding: string
55+
let version;
56+
if (context.eventName === 'workflow_dispatch') {
57+
version = context.payload.inputs.version;
58+
} else {
59+
version = context.ref.replace(/.*centraldogma-/, '');
60+
}
61+
console.log('Release version:', version);
62+
return version;
4763
4864
- name: Log in to the Container registry
4965
uses: docker/login-action@v3

0 commit comments

Comments
 (0)