Skip to content

Commit 4b59e43

Browse files
authored
Create tagged image when publishing a release (#43)
Signed-off-by: Nicko Guyer <[email protected]>
1 parent 608641a commit 4b59e43

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

.github/workflows/docker.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Docker
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
release:
5+
types: [published, prereleased]
76

87
jobs:
98
docker:
@@ -12,9 +11,19 @@ jobs:
1211
- uses: actions/checkout@v2
1312

1413
- name: Build
15-
run: docker build -t ghcr.io/hyperledger/firefly-dataexchange-https:latest .
16-
17-
- name: Push
14+
run: docker build -t ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} .
15+
16+
- name: Tag release
17+
if: github.event.action == 'published'
18+
run: docker tag ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly-dataexchange-https:latest
19+
20+
- name: Push docker image
21+
run: |
22+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
23+
docker push ghcr.io/hyperledger/firefly-dataexchange-https:${GITHUB_REF##*/}
24+
25+
- name: Push latest tag
26+
if: github.event.action == 'published'
1827
run: |
1928
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
20-
docker push ghcr.io/hyperledger/firefly-dataexchange-https:latest
29+
docker push ghcr.io/hyperledger/firefly-dataexchange-https:latest

0 commit comments

Comments
 (0)