Release Migrations - Prod #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Migrations - Prod | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: [self-hosted, linux] | |
timeout-minutes: 15 | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Guard | |
run: | | |
if [ $GITHUB_REF != 'refs/heads/develop' ]; then | |
echo "This action can only be run on the develop branch" | |
exit 1 | |
fi | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Merging migration files | |
run: cat $(ls -1) > ../migration-output.sql | |
working-directory: ${{ github.workspace }}/migrations/db/migrations | |
- name: configure aws credentials - prod | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.PROD_AWS_ROLE }} | |
aws-region: "ap-southeast-1" | |
- name: Deploy to S3 prod | |
shell: bash | |
run: aws s3 sync migrations/db s3://$AWS_S3_BUCKET/migrations/db --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.PG_INIT_SCRIPT_S3_BUCKET_PROD }} |