@@ -24,18 +24,19 @@ jobs:
24
24
contents : read
25
25
packages : write
26
26
outputs :
27
- image-node : ${{ steps.image-tag .outputs.image-node-service }}
28
- sha-short : ${{ steps.sha_short .outputs.sha_short }}
27
+ image-name : ${{ steps.vars .outputs.image_name }}
28
+ sha-short : ${{ steps.vars .outputs.sha_short }}
29
29
steps :
30
30
- name : Checkout repository
31
31
uses : actions/checkout@v4
32
32
33
- - name : Set SHA_SHORT environment variable
34
- id : sha_short
35
- run : echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
36
-
37
- - name : Check SHA_SHORT environment variable
38
- run : echo ${{ steps.sha_short.outputs.sha_short }}
33
+ - name : Set sha-short and image-name environment variables
34
+ id : vars
35
+ run : |
36
+ image_name=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.services.imageName }}" | tr '[:upper:]' '[:lower:]')
37
+ echo "image_name=$image_name" >> $GITHUB_OUTPUT
38
+ sha_short=$(echo "$(git rev-parse --short HEAD) | tr '[:upper:]' '[:lower:]')
39
+ echo "sha_short=$sha_short" >> $GITHUB_OUTPUT
39
40
40
41
# Login against a Docker registry except on PR
41
42
# https://github.com/docker/login-action
53
54
id : meta
54
55
uses : docker/metadata-action@v5
55
56
with :
56
- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.services.imageName }}
57
+ images : ${{ steps.vars.outputs.image_name }}
57
58
tags : |
58
59
type=semver,pattern={{version}}
59
60
type=semver,pattern={{major}}.{{minor}}
72
73
tags : ${{ steps.meta.outputs.tags }}
73
74
labels : ${{ steps.meta.outputs.labels }}
74
75
75
- - name : Output image tag
76
- id : image-tag
77
- run : |
78
- name=$(echo "image-${{ matrix.services.imageName }}" | tr '[:upper:]' '[:lower:]')
79
- value=$(echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.services.imageName }}:sha-${{ steps.sha_short.outputs.sha_short }}" | tr '[:upper:]' '[:lower:]')
80
- echo "setting output: $name=$value"
81
- echo "$name=$value" >> $GITHUB_OUTPUT
82
-
83
76
deploy :
84
77
runs-on : ubuntu-latest
85
78
if : github.event_name != 'pull_request'
@@ -108,13 +101,16 @@ jobs:
108
101
DEPLOYMENT_NAME="${REF_SHA////-}"
109
102
echo "DEPLOYMENT_NAME=$DEPLOYMENT_NAME"
110
103
104
+ webServiceImage="${{ needs.build.outputs.image-name }}:sha-${{ needs.build.outputs.sha-short }}"
105
+ echo "webServiceImage=$webServiceImage"
106
+
111
107
TAGS='{"owner":"johnnyreilly", "email":"johnny_reilly@hotmail.com"}'
112
108
az deployment group create \
113
109
--resource-group ${{ env.RESOURCE_GROUP }} \
114
110
--name "$DEPLOYMENT_NAME" \
115
111
--template-file ./infra/main.bicep \
116
112
--parameters \
117
- webServiceImage='${{ needs.build.outputs.image-node }}' \
113
+ webServiceImage="$webServiceImage" \
118
114
containerRegistry=${{ env.REGISTRY }} \
119
115
containerRegistryUsername=${{ github.actor }} \
120
116
containerRegistryPassword=${{ secrets.PACKAGES_TOKEN }} \
0 commit comments