@@ -22,12 +22,13 @@ jobs:
2222 name : Vars
2323 runs-on : ubuntu-24.04
2424 outputs :
25- tag : ${{ steps.changelog .outputs.tag || github.event.release.tag_name || '' }}
26- version : ${{ steps.changelog .outputs.version || github.event.release.tag_name || '' }}
25+ tag : ${{ steps.release .outputs.tag }}
26+ tags : ${{ steps.release .outputs.tags }}
2727 clean_changelog : ${{ steps.changelog.outputs.clean_changelog || '' }}
2828 steps :
2929 - uses : actions/checkout@v4
3030 - name : Conventional Changelog Update
31+ if : (github.event_name != 'release')
3132 uses : TriPSs/conventional-changelog-action@v6
3233 id : changelog
3334 continue-on-error : true
3839 skip-on-empty : " false"
3940 skip-commit : " true"
4041 git-push : " true"
42+ - name : GitHub Release
43+ id : release
44+ shell : bash
45+ run : |
46+ # Determine the tag based on the event type
47+ tag=""
48+ version=""
49+ if [[ "${{ github.event_name }}" == "release" ]]; then
50+ echo "getting tag from release which was done manually in github"
51+ # remove all spaces and new lines from the tag name and make it lowercase.
52+ tag=$(echo "${{ github.event.release.tag_name }}" | tr -d ' \n\r\t' | tr '[:upper:]' '[:lower:]')
53+ version=$(echo "$tag" | sed 's/^v//') # Compute version as tag without the leading 'v'
54+ elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
55+ echo "generating tag from workflow dispatch"
56+ # Generate tag from current timestamp or use a default
57+ tag=$(echo "${{ steps.changelog.outputs.tag}}" | tr -d ' \n\r\t' | tr '[:upper:]' '[:lower:]')
58+ version="${{ steps.changelog.outputs.version}}"
59+ else
60+ echo "unsupported event type: ${{ github.event_name }}"
61+ exit 1
62+ fi
63+ echo "tag=$tag" >> $GITHUB_OUTPUT
64+ echo "version=$version" >> $GITHUB_OUTPUT
65+
66+ # Generate multiline tags output for retag-images step
67+ tags=$(printf "prod\n%s\n%s" "$version" "$tag")
68+
69+ # Trim and set multiline outputs
70+ echo "tags<<EOF" >> $GITHUB_OUTPUT
71+ echo "$tags" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' >> $GITHUB_OUTPUT
72+ echo "EOF" >> $GITHUB_OUTPUT
4173 retag-images :
4274 name : Retag Images
4375 needs : [vars]
5183 with :
5284 registry : ghcr.io
5385 repository : ${{ github.repository }}/${{ matrix.package }}
54- target : ${{inputs.containers_tag}} # this is the tag of the containers to deploy, defaults to test
86+ target : ${{inputs.containers_tag || 'test' }} # this is the tag of the containers to deploy, defaults to test
5587 tags : |
56- prod
57- ${{ needs.vars.outputs.version}}
88+ ${{ needs.vars.outputs.tags }}
5889 resume-resources :
5990 name : Resume Resources # This job resumes resources for the merged PR which is needed if the resources were paused.
6091 needs : [vars]
70101 with :
71102 environment_name : dev # since we only have one namespace dev, update this to PROD
72103 command : apply
73- tag : ${{ needs.vars.outputs.version }} # this is the tag of the containers to deploy
104+ tag : ${{ needs.vars.outputs.tag }} # this is the tag of the containers to deploy
74105 app_env : prod
75106 release :
76107 name : Github Release
0 commit comments