File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change 1
1
name : ghcr
2
2
on :
3
- workflow_dispatch :
4
- inputs :
5
- version :
6
- type : string
7
- required : true
8
- description : version (e.g. 1.2.3)
3
+ push :
4
+ tags :
5
+ - " v*"
9
6
env :
10
7
IMAGE_NAME : workshop-azure-openai
11
8
jobs :
12
- publish :
9
+ ghcr :
13
10
runs-on : ubuntu-latest
11
+ timeout-minutes : 5
14
12
permissions :
15
13
packages : write
16
14
contents : read
@@ -21,12 +19,25 @@ jobs:
21
19
registry : ghcr.io
22
20
username : ${{ github.actor }}
23
21
password : ${{ secrets.GITHUB_TOKEN }}
24
- - uses : docker/metadata-action@v5
22
+ - name : Set Versions
23
+ uses : actions/github-script@v7
24
+ id : set_version
25
+ with :
26
+ script : |
27
+ const tag = context.ref.substring(10)
28
+ const no_v = tag.replace('v', '')
29
+ const dash_index = no_v.lastIndexOf('-')
30
+ const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
31
+ core.setOutput('tag', tag)
32
+ core.setOutput('no-v', no_v)
33
+ core.setOutput('no-dash', no_dash)
34
+ - name : Set meta data tag = ${{steps.set_version.outputs.no-dash}}
35
+ uses : docker/metadata-action@v5
25
36
id : meta
26
37
with :
27
38
images : ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
28
39
tags : |
29
- type=semver,pattern={{version}},value=v${{ inputs.version }}
40
+ type=semver,pattern={{version}},value=v${{steps.set_version.outputs.no-dash }}
30
41
type=raw,value=latest
31
42
- uses : docker/build-push-action@v5
32
43
with :
You can’t perform that action at this time.
0 commit comments