From 8fe9495822f68d363c3781210c0dc571143477c5 Mon Sep 17 00:00:00 2001 From: Pablo <118397961+pablin-10@users.noreply.github.com> Date: Fri, 19 Apr 2024 13:21:38 +0200 Subject: [PATCH] Reenable auto-deploy to stage --- .github/workflows/push-dev-docker-images.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push-dev-docker-images.yml b/.github/workflows/push-dev-docker-images.yml index f84dc6c7d..c4b662777 100644 --- a/.github/workflows/push-dev-docker-images.yml +++ b/.github/workflows/push-dev-docker-images.yml @@ -23,27 +23,27 @@ jobs: docker: runs-on: ubuntu-latest steps: - - + - name: Check out repo uses: actions/checkout@v4 with: fetch-depth: 0 - - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - + - name: Login to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - + - name: Create Docker Image Tags run: | SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-8) echo "DOCKER_IMAGE_TAG=${{ github.ref_name }}-${SHORT_SHA}" >> $GITHUB_ENV echo "DOCKER_IMAGE_TAG_WITH_DATE=${{ github.ref_name }}-${SHORT_SHA}-$(date +%s)" >> $GITHUB_ENV - - + - name: Build and Push Docker Images uses: docker/build-push-action@v5 with: @@ -54,10 +54,13 @@ jobs: tags: | ${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} ${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG_WITH_DATE }} + - name: Get default branch name + run: echo "The default branch is ${{ github.event.repository.default_branch }} and the actual branch is ${{ github.ref }}" - - if: github.ref == 'refs/heads/{{ github.event.repository.default_branch }}' + if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} name: Send Webhook to deploy automatically to stage run: | echo '{"sqsdockerversion":"${{ env.DOCKER_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }}"}' > temp.json jq -s '.[0] * .[1]' config.json temp.json > combined_config.json curl -H "Content-Type: application/json" -X POST -d @combined_config.json ${{ secrets.DEPLOY_URL }} +