|
| 1 | +name: Publish pg_upgrade_scripts |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + paths: |
| 8 | + - '.github/workflows/publish-pgupgrade-scripts.yml' |
| 9 | + - 'common.vars.pkr.hcl' |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + id-token: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout Repo |
| 21 | + uses: actions/checkout@v3 |
| 22 | + |
| 23 | + - name: Grab release version |
| 24 | + id: process_release_version |
| 25 | + run: | |
| 26 | + VERSION=$(sed -e 's/postgres-version = "\(.*\)"/\1/g' common.vars.pkr.hcl) |
| 27 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 28 | +
|
| 29 | + - name: Create a tarball containing pg_upgrade scripts |
| 30 | + run: | |
| 31 | + mkdir -p /tmp/pg_upgrade_scripts |
| 32 | + cp -r ansible/files/admin_api_scripts/pg_upgrade_scripts/* /tmp/pg_upgrade_scripts |
| 33 | + tar -czvf /tmp/pg_upgrade_scripts.tar.gz -C /tmp/ pg_upgrade_scripts |
| 34 | +
|
| 35 | + - name: configure aws credentials - staging |
| 36 | + uses: aws-actions/configure-aws-credentials@v1 |
| 37 | + with: |
| 38 | + role-to-assume: ${{ secrets.DEV_AWS_ROLE }} |
| 39 | + aws-region: "us-east-1" |
| 40 | + |
| 41 | + - name: Upload pg_upgrade scripts to s3 staging |
| 42 | + run: | |
| 43 | + aws s3 cp /tmp/pg_upgrade_scripts.tar.gz s3://${{ secrets.ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/pg_upgrade_scripts.tar.gz |
| 44 | +
|
| 45 | + - name: configure aws credentials - prod |
| 46 | + uses: aws-actions/configure-aws-credentials@v1 |
| 47 | + with: |
| 48 | + role-to-assume: ${{ secrets.PROD_AWS_ROLE }} |
| 49 | + aws-region: "us-east-1" |
| 50 | + |
| 51 | + - name: Upload pg_upgrade scripts to s3 prod |
| 52 | + run: | |
| 53 | + aws s3 cp /tmp/pg_upgrade_scripts.tar.gz s3://${{ secrets.PROD_ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/pg_upgrade_scripts.tar.gz |
| 54 | +
|
| 55 | + - name: Slack Notification on Failure |
| 56 | + if: ${{ failure() }} |
| 57 | + uses: rtCamp/action-slack-notify@v2 |
| 58 | + env: |
| 59 | + SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }} |
| 60 | + SLACK_USERNAME: 'gha-failures-notifier' |
| 61 | + SLACK_COLOR: 'danger' |
| 62 | + SLACK_MESSAGE: 'Publishing pg_upgrade scripts failed' |
| 63 | + SLACK_FOOTER: '' |
0 commit comments