From 734fbd74b9b46f2271039f3935f45629ca60282a Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 17 Sep 2024 15:03:46 +0200 Subject: [PATCH 1/4] Add dependabot for gh actions --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ca79ca5 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly From b7af2e858b45eff915d0bd11eaba5e506a21950c Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 17 Sep 2024 15:13:45 +0200 Subject: [PATCH 2/4] On push to main, trigger sync for demo --- .github/workflows/use-prod-sha-for-demo.yml | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/use-prod-sha-for-demo.yml diff --git a/.github/workflows/use-prod-sha-for-demo.yml b/.github/workflows/use-prod-sha-for-demo.yml new file mode 100644 index 0000000..8ad1755 --- /dev/null +++ b/.github/workflows/use-prod-sha-for-demo.yml @@ -0,0 +1,40 @@ +name: Sync Demo Hash with Production + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + sync-demo-hash: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Get production SHA + id: get_production_sha + run: | + PRODUCTION_SHA=$(jq -r '.head_sha' deploy/production/config.json) + echo "PRODUCTION_SHA=$PRODUCTION_SHA" >> $GITHUB_OUTPUT + + - name: Update demo config + run: | + CONFIG_FILE="deploy/demo/config.json" + jq --arg sha "${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}" '.head_sha = $sha' $CONFIG_FILE > tmp.json && mv tmp.json $CONFIG_FILE + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Bump demo SHA to production SHA ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}" + title: "Bump demo to production: ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}" + body: | + This PR automatically syncs the demo environment with the current production SHA. + + Production SHA: ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }} + + Please review and approve to update the demo environment. + branch: sync-demo-with-production-${{ steps.get_production_sha.outputs.PRODUCTION_SHA }} + base: main \ No newline at end of file From 580912ae1eb15cf4198e79dfd9b5c13e627f739e Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 17 Sep 2024 15:32:09 +0200 Subject: [PATCH 3/4] Update .github/workflows/use-prod-sha-for-demo.yml Co-authored-by: Theo Sanderson --- .github/workflows/use-prod-sha-for-demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/use-prod-sha-for-demo.yml b/.github/workflows/use-prod-sha-for-demo.yml index 8ad1755..15e83be 100644 --- a/.github/workflows/use-prod-sha-for-demo.yml +++ b/.github/workflows/use-prod-sha-for-demo.yml @@ -1,4 +1,4 @@ -name: Sync Demo Hash with Production +name: Create PR to Sync Demo Hash with Production on: workflow_dispatch: From 6d154071ceff614b75b0d2189a81c94df995e96c Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Tue, 17 Sep 2024 15:32:15 +0200 Subject: [PATCH 4/4] Update .github/workflows/use-prod-sha-for-demo.yml Co-authored-by: Theo Sanderson --- .github/workflows/use-prod-sha-for-demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/use-prod-sha-for-demo.yml b/.github/workflows/use-prod-sha-for-demo.yml index 15e83be..29efd8a 100644 --- a/.github/workflows/use-prod-sha-for-demo.yml +++ b/.github/workflows/use-prod-sha-for-demo.yml @@ -31,7 +31,7 @@ jobs: commit-message: "Bump demo SHA to production SHA ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}" title: "Bump demo to production: ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}" body: | - This PR automatically syncs the demo environment with the current production SHA. + This PR syncs the demo environment with the current production SHA. Production SHA: ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}