|
17 | 17 |
|
18 | 18 | env:
|
19 | 19 | BACKEND_IMAGE: backend
|
20 |
| - SHORT_SHA: $(echo "${{ github.sha }}" | cut -c1-7) |
| 20 | + SHORT_SHA: ${GITHUB_SHA::7} |
21 | 21 |
|
22 | 22 | jobs:
|
23 | 23 | TODO-BACKEND-CI:
|
24 | 24 | runs-on: ubuntu-latest
|
| 25 | + env: |
| 26 | + SHA12: ${GITHUB_SHA::12} |
25 | 27 | steps:
|
26 | 28 | - name: Checkout code
|
27 | 29 | uses: actions/checkout@v2
|
@@ -55,47 +57,49 @@ jobs:
|
55 | 57 | run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
|
56 | 58 |
|
57 | 59 | - name: Push Image Tag
|
| 60 | + id: push_image_tag |
58 | 61 | run: |
|
59 | 62 | IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$BACKEND_IMAGE
|
60 | 63 | IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
61 |
| - VERSION=$GITHUB_SHA |
| 64 | + VERSION=${GITHUB_SHA:0:7} |
62 | 65 | echo IMAGE_ID=$IMAGE_ID
|
63 | 66 | echo VERSION=$VERSION
|
64 | 67 | docker tag $BACKEND_IMAGE $IMAGE_ID:$VERSION
|
65 | 68 | docker push $IMAGE_ID:$VERSION
|
| 69 | + echo "::set-output name=VERSION::$VERSION" |
66 | 70 |
|
67 | 71 | - name: Update Helm Chart Values at Main
|
68 | 72 | if: ${{ github.ref == 'refs/heads/main'}}
|
69 | 73 | uses: Nextdoor/helm-set-image-tag-action@main
|
70 | 74 | with:
|
71 | 75 | values_files: charts/values.yaml
|
72 | 76 | tag_keys: .backend.tag
|
73 |
| - tag_value: ${{ github.sha }} |
| 77 | + tag_value: ${{ steps.push_image_tag.outputs.VERSION }} |
74 | 78 | commit_branch: ${{ github.ref }}
|
75 |
| - commit_tag: Todo-Main-Charts |
76 |
| - commit_message: "Tag Backend:${{ env.SHORT_SHA }} Pumped" |
| 79 | + commit_tag: Todo-Main-Charts-V-${{ steps.push_image_tag.outputs.VERSION }} |
| 80 | + commit_message: "Backend update: Tag '${{ steps.push_image_tag.outputs.VERSION }}' added" |
77 | 81 |
|
78 | 82 | - name: Update Helm Chart Values at Stage
|
79 | 83 | if: ${{ github.ref == 'refs/heads/stage'}}
|
80 | 84 | uses: Nextdoor/helm-set-image-tag-action@main
|
81 | 85 | with:
|
82 | 86 | values_files: charts/values.yaml
|
83 | 87 | tag_keys: .backend.tag
|
84 |
| - tag_value: ${{ github.sha }} |
| 88 | + tag_value: ${{ steps.push_image_tag.outputs.VERSION }} |
85 | 89 | commit_branch: ${{ github.ref }}
|
86 |
| - commit_tag: Todo-Stage-Charts |
87 |
| - commit_message: "Tag Backend:${{ env.SHORT_SHA }} Pumped" |
| 90 | + commit_tag: Todo-Stage-Charts-V-${{ steps.push_image_tag.outputs.VERSION }} |
| 91 | + commit_message: "Backend update: Tag '${{ steps.push_image_tag.outputs.VERSION }}' added" |
88 | 92 |
|
89 | 93 | - name: Update Helm Chart Values at Dev
|
90 | 94 | if: ${{ github.ref == 'refs/heads/dev'}}
|
91 | 95 | uses: Nextdoor/helm-set-image-tag-action@main
|
92 | 96 | with:
|
93 | 97 | values_files: charts/values.yaml
|
94 | 98 | tag_keys: .backend.tag
|
95 |
| - tag_value: ${{ github.sha }} |
| 99 | + tag_value: ${{ steps.push_image_tag.outputs.VERSION }} |
96 | 100 | commit_branch: ${{ github.ref }}
|
97 |
| - commit_tag: Todo-Dev-Charts |
98 |
| - commit_message: "Tag Backend:${{ env.SHORT_SHA }} Pumped" |
| 101 | + commit_tag: Todo-Dev-Charts-V-${{ steps.push_image_tag.outputs.VERSION }} |
| 102 | + commit_message: "Backend update: Tag '${{ steps.push_image_tag.outputs.VERSION }}' added" |
99 | 103 |
|
100 | 104 | # - name: 'Updating Helm Charts values on branch main'
|
101 | 105 | # if: ${{ github.ref == 'refs/heads/main' }}
|
|
0 commit comments