Skip to content

Commit a47d673

Browse files
authored
Merge pull request #91 from metacpan/haarg/update-image-workflow
add workflow for updating deployed image tag
2 parents 173cdc4 + 3abe20d commit a47d673

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

Diff for: .github/workflows/set-image.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Update Image with Kustomize
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
app:
6+
description: 'Application'
7+
required: true
8+
type: choice
9+
options:
10+
- api
11+
- grep
12+
- web
13+
environment:
14+
description: 'Environment'
15+
default: prod
16+
type: choice
17+
options:
18+
- prod
19+
- stage
20+
repository:
21+
description: 'Repository'
22+
required: true
23+
type: string
24+
tag:
25+
description: 'Tag'
26+
required: true
27+
type: string
28+
29+
jobs:
30+
update-image:
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Generate Auth Token
35+
id: auth-token
36+
uses: jamestrousdale/[email protected]
37+
with:
38+
app-id: ${{ secrets.APP_ID }}
39+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
40+
- id: git-user
41+
name: Set up git user
42+
uses: haarg/setup-git-user@v1
43+
with:
44+
jwt: ${{ steps.auth-token.outputs.jwt }}
45+
- uses: actions/checkout@v4
46+
with:
47+
token: ${{ steps.auth-token.outputs.access-token }}
48+
- name: Set up Kustomize
49+
uses: imranismail/setup-kustomize@v2
50+
- name: Update Image Tag
51+
working-directory: ./apps/${{ inputs.app }}/environments/${{ inputs.environment }}
52+
run: |
53+
kustomize edit set image "${{ inputs.repository }}:latest" "${{ inputs.repository }}:${{ inputs.tag }}"
54+
git add .
55+
git commit -m "Update ${{ inputs.app }} to ${{ github.sha }}"
56+
- name: Push manifests
57+
run: git push

0 commit comments

Comments
 (0)