From 7a6c8b48f0234154eb63bda57f177ad82916d7c4 Mon Sep 17 00:00:00 2001 From: Neil Enns Date: Thu, 21 Mar 2024 06:17:54 -0700 Subject: [PATCH] Re-enable Portainer deployment (#1180) * Re-enable Portainer deployment Fixes #896 * Add verbose flag * Finalize variable names --- .github/workflows/dev_release.yaml | 6 ++-- .github/workflows/release.yaml | 56 +++++++++++++++--------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/dev_release.yaml b/.github/workflows/dev_release.yaml index 0366b680..3bdc75f1 100644 --- a/.github/workflows/dev_release.yaml +++ b/.github/workflows/dev_release.yaml @@ -76,16 +76,16 @@ jobs: # -H adds the two Cloudflare headers to allow webhook access - name: Deploy to Portainer run: | - status_code=$(curl -X POST \ + status_code=$(curl -v -X POST \ -L \ -w "%{http_code}" \ -s \ -o /dev/null \ -H "CF-Access-Client-Id: ${{ secrets.CF_ACCESS_CLIENT_ID }}" \ -H "CF-Access-Client-Secret: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}" \ - "${{ secrets.PORTAINER_WEBHOOK_URL }}") + "${{ vars.PORTAINER_WEBHOOK_URL }}") echo "Status code received: $status_code" - if [ $status_code -eq 200 ]; then + if [ $status_code -eq 204 ]; then echo "Deployment succeeded" else echo "Deployment failed" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2e0c2770..138786f3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,6 +6,7 @@ on: jobs: build-and-push-image: + environment: production runs-on: ubuntu-latest strategy: fail-fast: false @@ -64,31 +65,30 @@ jobs: build-args: | VERSION=${{ github.event.release.tag_name }} - # Issue 889: Disable for now until Portainer fixes the bug on their end preventing this from working - # deploy: - # runs-on: ubuntu-latest - # needs: build-and-push-image - # environment: production - # steps: - # - name: Deploy to Portainer - # -L makes curl follow the redirect from cloudflare - # -w captures the HTTP code - # -s is silent so no progress bar shows - # -o /dev/null sends the response to null so it doesn't contaminate the response code - # -H adds the two Cloudflare headers to allow webhook access - # run: | - # status_code=$(curl -X POST \ - # -L \ - # -w "%{http_code}" \ - # -s \ - # -o /dev/null \ - # -H "CF-Access-Client-Id: ${{ secrets.CF_ACCESS_CLIENT_ID }}" \ - # -H "CF-Access-Client-Secret: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}" \ - # "${{ secrets.PORTAINER_WEBHOOK_URL }}") - # echo "Status code received: $status_code" - # if [ $status_code -eq 200 ]; then - # echo "Deployment succeeded" - # else - # echo "Deployment failed" - # exit 1 - # fi + deploy: + runs-on: ubuntu-latest + needs: build-and-push-image + environment: production + steps: + # -L makes curl follow the redirect from cloudflare + # -w captures the HTTP code + # -s is silent so no progress bar shows + # -o /dev/null sends the response to null so it doesn't contaminate the response code + # -H adds the two Cloudflare headers to allow webhook access + - name: Deploy to Portainer + run: | + status_code=$(curl -v -X POST \ + -L \ + -w "%{http_code}" \ + -s \ + -o /dev/null \ + -H "CF-Access-Client-Id: ${{ secrets.CF_ACCESS_CLIENT_ID }}" \ + -H "CF-Access-Client-Secret: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}" \ + "${{ vars.PORTAINER_WEBHOOK_URL }}") + echo "Status code received: $status_code" + if [ $status_code -eq 204 ]; then + echo "Deployment succeeded" + else + echo "Deployment failed" + exit 1 + fi