Sfoglia il codice sorgente

[xc-admin-frontend] fix github action (#657)

* Missing dollar sign

* Test push:

* Fix truncate

* Long hash

* Add checkout step

* Shortened hash

* Add spaces

* Get date from command

* Remove push on pull request
guibescos 2 anni fa
parent
commit
4524bd4984
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6 1
      .github/workflows/xc-admin-frontend-image-push.yaml

+ 6 - 1
.github/workflows/xc-admin-frontend-image-push.yaml

@@ -10,6 +10,12 @@ jobs:
   xc-admin-image:
     runs-on: ubuntu-latest
     steps:
+      - uses: actions/checkout@v2
+      - name: Set image tag to timestamp and shortened commit hash
+        run: |
+          SHORT_HASH=$(echo ${{ github.sha }} | cut -c1-7)
+          TIMESTAMP=$(date +%s)
+          echo "IMAGE_TAG=${TIMESTAMP}-${SHORT_HASH}" >> "${GITHUB_ENV}"
       - uses: aws-actions/configure-aws-credentials@8a84b07f2009032ade05a88a28750d733cc30db1
         with:
           role-to-assume: arn:aws:iam::192824654885:role/github-actions-ecr
@@ -23,4 +29,3 @@ jobs:
         env:
           ECR_REGISTRY: ${{ steps.ecr_login.outputs.registry }}
           ECR_REPOSITORY: xc-admin-frontend
-          IMAGE_TAG: ${{ github.event.head_commit.timestamp }}-{{github.sha | truncate(7, '')}}