Skip to content

Commit 82ec7fa

Browse files
committed
chore(github-action): create an action to manually tag and release - set output
1 parent d2fed7f commit 82ec7fa

File tree

1 file changed

+159
-170
lines changed

1 file changed

+159
-170
lines changed

.github/workflows/tag-docker-image.yml

Lines changed: 159 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -19,174 +19,164 @@ jobs:
1919
packages: write
2020
contents: write
2121
steps:
22-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23-
-
24-
name: Login to DockerHub
25-
uses: docker/login-action@v3
26-
with:
27-
username: ${{ secrets.DOCKERHUB_USERNAME }}
28-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
29-
-
30-
name: Login to GitHub Container Registry
31-
uses: docker/login-action@v3
32-
with:
33-
registry: ghcr.io
34-
username: ${{ github.repository_owner }}
35-
password: ${{ secrets.GITHUB_TOKEN }}
36-
-
37-
name: Bump version
38-
id: bump-version
39-
uses: ietf-tools/semver-action@1c7c3f023f427188333afc94c8b91c76d63ec799 # v1
40-
with:
41-
token: ${{ github.token }}
42-
branch: main
43-
noVersionBumpBehavior: patch
44-
majorList: major
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
- name: Login to DockerHub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.repository_owner }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Bump version
35+
id: bump-version
36+
uses: ietf-tools/semver-action@1c7c3f023f427188333afc94c8b91c76d63ec799 # v1
37+
with:
38+
token: ${{ github.token }}
39+
branch: main
40+
noVersionBumpBehavior: patch
41+
majorList: major
4542

46-
-
47-
name: publish curl-ssl image
48-
uses: docker/[email protected]
49-
with:
50-
context: ${{env.IMAGE}}
51-
push: true
52-
tags: |
53-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
54-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
55-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
56-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
57-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
58-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
59-
env:
60-
IMAGE: curl-ssl
61-
-
62-
name: publish git-ssh image
63-
uses: docker/[email protected]
64-
with:
65-
context: ${{env.IMAGE}}
66-
push: true
67-
tags: |
68-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
69-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
70-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
71-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
72-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
73-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
74-
env:
75-
IMAGE: git-ssh
76-
-
77-
name: publish cf-cli image
78-
uses: docker/[email protected]
79-
with:
80-
context: ${{env.IMAGE}}
81-
push: true
82-
tags: |
83-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
84-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
85-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
86-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
87-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
88-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
89-
env:
90-
IMAGE: cf-cli
91-
-
92-
name: publish k8s-tools image
93-
uses: docker/[email protected]
94-
with:
95-
context: ${{env.IMAGE}}
96-
push: true
97-
tags: |
98-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
99-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
100-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
101-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
102-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
103-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
104-
env:
105-
IMAGE: k8s-tools
106-
-
107-
name: publish bosh-cli-v2 image
108-
uses: docker/[email protected]
109-
with:
110-
context: ${{env.IMAGE}}
111-
push: true
112-
tags: |
113-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
114-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
115-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
116-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
117-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
118-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
119-
env:
120-
IMAGE: bosh-cli-v2
121-
-
122-
name: publish terraform image
123-
uses: docker/[email protected]
124-
with:
125-
context: ${{env.IMAGE}}
126-
push: true
127-
tags: |
128-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
129-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
130-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
131-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
132-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
133-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
134-
env:
135-
IMAGE: terraform
136-
-
137-
name: publish spruce image
138-
uses: docker/[email protected]
139-
with:
140-
context: ${{env.IMAGE}}
141-
push: true
142-
tags: |
143-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
144-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
145-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
146-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
147-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
148-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
149-
env:
150-
IMAGE: spruce
151-
-
152-
name: publish awscli image
153-
uses: docker/[email protected]
154-
with:
155-
context: ${{env.IMAGE}}
156-
push: true
157-
tags: |
158-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
159-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
160-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
161-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
162-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
163-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
164-
env:
165-
IMAGE: awscli
166-
-
167-
name: publish bosh-cli-v2-cf-cli image
168-
uses: docker/[email protected]
169-
with:
170-
context: ${{env.IMAGE}}
171-
push: true
172-
tags: |
173-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
174-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
175-
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
176-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
177-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
178-
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
179-
env:
180-
IMAGE: bosh-cli-v2-cf-cli
181-
- # see https://github.com/ncipollo/release-action
182-
name: create github release
183-
id: create-github-release
184-
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1.15.0
185-
with:
186-
tag: ${{ steps.bump-version.outputs.next}}
187-
draft: false
188-
allowUpdates: false # > indicates if we should update a release if it already exists.
189-
generateReleaseNotes: true
43+
- name: publish curl-ssl image
44+
uses: docker/[email protected]
45+
with:
46+
context: ${{env.IMAGE}}
47+
push: true
48+
tags: |
49+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
50+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
51+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
52+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
53+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
54+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
55+
env:
56+
IMAGE: curl-ssl
57+
- name: publish git-ssh image
58+
uses: docker/[email protected]
59+
with:
60+
context: ${{env.IMAGE}}
61+
push: true
62+
tags: |
63+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
64+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
65+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
66+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
67+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
68+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
69+
env:
70+
IMAGE: git-ssh
71+
- name: publish cf-cli image
72+
uses: docker/[email protected]
73+
with:
74+
context: ${{env.IMAGE}}
75+
push: true
76+
tags: |
77+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
78+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
79+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
80+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
81+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
82+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
83+
env:
84+
IMAGE: cf-cli
85+
- name: publish k8s-tools image
86+
uses: docker/[email protected]
87+
with:
88+
context: ${{env.IMAGE}}
89+
push: true
90+
tags: |
91+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
92+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
93+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
94+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
95+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
96+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
97+
env:
98+
IMAGE: k8s-tools
99+
- name: publish bosh-cli-v2 image
100+
uses: docker/[email protected]
101+
with:
102+
context: ${{env.IMAGE}}
103+
push: true
104+
tags: |
105+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
106+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
107+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
108+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
109+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
110+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
111+
env:
112+
IMAGE: bosh-cli-v2
113+
- name: publish terraform image
114+
uses: docker/[email protected]
115+
with:
116+
context: ${{env.IMAGE}}
117+
push: true
118+
tags: |
119+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
120+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
121+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
122+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
123+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
124+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
125+
env:
126+
IMAGE: terraform
127+
- name: publish spruce image
128+
uses: docker/[email protected]
129+
with:
130+
context: ${{env.IMAGE}}
131+
push: true
132+
tags: |
133+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
134+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
135+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
136+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
137+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
138+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
139+
env:
140+
IMAGE: spruce
141+
- name: publish awscli image
142+
uses: docker/[email protected]
143+
with:
144+
context: ${{env.IMAGE}}
145+
push: true
146+
tags: |
147+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
148+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
149+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
150+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
151+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
152+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
153+
env:
154+
IMAGE: awscli
155+
- name: publish bosh-cli-v2-cf-cli image
156+
uses: docker/[email protected]
157+
with:
158+
context: ${{env.IMAGE}}
159+
push: true
160+
tags: |
161+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:latest
162+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{github.sha}}
163+
${{env.DOCKERHUB_ORG}}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
164+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:latest
165+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{github.sha}}
166+
ghcr.io/${{ github.repository }}/${{env.IMAGE}}:${{ steps.bump-version.outputs.next}}
167+
env:
168+
IMAGE: bosh-cli-v2-cf-cli
169+
- # see https://github.com/ncipollo/release-action
170+
name: create github release
171+
id: create-github-release
172+
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1.15.0
173+
with:
174+
tag: ${{ steps.bump-version.outputs.next}}
175+
draft: false
176+
allowUpdates: false # > indicates if we should update a release if it already exists.
177+
generateReleaseNotes: true
178+
outputs:
179+
tagged_image_version: ${{ steps.bump-version.outputs.next}}
190180

191181
check_tagged_images:
192182
name: check tagged images
@@ -200,12 +190,11 @@ jobs:
200190
with:
201191
username: ${{ secrets.DOCKERHUB_USERNAME }}
202192
password: ${{ secrets.DOCKERHUB_PASSWORD }}
203-
-
204-
name: check docker public images
193+
- name: check docker public images
205194
run: | # shellcheck disable=SC2086
206195
for image in $BASE_IMAGES $IMAGES_WITH_DEPENDENCIES;do
207196
echo "Processing $image: checking manifest for $DOCKERHUB_ORG/$image:$IMAGE_VERSION"
208197
docker manifest inspect $DOCKERHUB_ORG/$image:$IMAGE_VERSION
209198
done
210199
env:
211-
IMAGE_VERSION: ${{ steps.bump-version.outputs.next}}
200+
IMAGE_VERSION: ${{ needs.tag_and_release.outputs.tagged_image_version}}

0 commit comments

Comments
 (0)