Skip to content

Commit b4a4e90

Browse files
authored
Merge pull request #283 from plural/docker-image-tag-hopeful-fix
Try to fix image tagging.
2 parents 960ee74 + f4df131 commit b4a4e90

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,9 @@ jobs:
111111
- name: Log in to DO Container Registry
112112
run: doctl registry login --expiry-seconds 600
113113

114-
- name: Tag image with run id
115-
if: github.ref == 'refs/heads/main'
116-
run: docker tag $IMAGENAME:${{ github.run_id }}
117-
118-
- name: Tag image with latest if main branch
119-
if: github.ref == 'refs/heads/main'
120-
run: docker tag $IMAGENAME:latest
121-
122-
- name: Tag image with release tag if release branch
123-
if: github.event_name == 'release'
124-
run: docker tag $IMAGENAME:release-${{ github.ref_name }}
125-
126-
- name: Push image to DO Container Registry
127-
run: docker push $IMAGENAME:${{ github.run_id }} && docker push $IMAGENAME:latest
114+
- name: Tag image and publish image
115+
env:
116+
IMAGETAG: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }}
117+
run: |
118+
docker tag $IMAGETAG $IMAGENAME:${{ github.run_id }}
119+
docker push $IMAGENAME:${{ github.run_id }} && docker push $IMAGETAG

0 commit comments

Comments
 (0)