Skip to content

Commit b2e88b8

Browse files
2 parents ea88465 + 7e90375 commit b2e88b8

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

github-actions/workflows/deploy-build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ env:
1515

1616
# Repository Secrets - Create these in Project Settings > Secrets > Actions
1717
TOKEN: ${{ secrets.FLYWAY_TOKEN }}
18-
DB_USER_Build: ${{ secrets.DB_USER_NAME_QA }}
19-
DB_USER_PW_Build: ${{ secrets.DB_USER_PW_QA }}
18+
DB_USER_BUILD: ${{ secrets.DB_USER_NAME_BUILD }}
19+
DB_USER_PW_BUILD: ${{ secrets.DB_USER_PW_BUILD }}
2020
FIRST_UNDO_SCRIPT: ${{ secrets.FIRST_UNDO_SCRIPT }} # Validates all undo scripts up to and including the specified script
2121

2222
# jobs are the steps executed in the workflow
@@ -26,7 +26,7 @@ jobs:
2626
# runs-on: ubuntu-latest
2727
defaults:
2828
run:
29-
shell: cmd # Default shell. Use Windows Command Prompt
29+
shell: cmd # Default shell. Use Windows Command Prompt. bash for linux.
3030
steps: # Steps are the individual tasks that are executed in the job
3131
- name: Checkout Repository # Step to check out the repository
3232
uses: actions/checkout@v4
@@ -38,13 +38,13 @@ jobs:
3838
# Runs the Flyway Clean command against the Build database
3939
- name: Clean Build DB
4040
run: |
41-
flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} info clean info -cleanDisabled="false" -user=${{ env.DB_USER_Build }} -password=${{ env.DB_USER_PW_Build }} -url=${{ env.JDBC_BUILD }} -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
41+
flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} info clean info -cleanDisabled="false" -user=${{ env.DB_USER_BUILD }} -password=${{ env.DB_USER_PW_BUILD }} -url=${{ env.JDBC_BUILD }} -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
4242
4343
- name: Migrate Build # Step to run Flyway migrations
4444
# To use username and password instead of windows integrated security Ensure that SQL Server is configured to allow SQL Server authentication. You can check this in SQL Server Management Studio (SSMS) under the server properties -> Security -> Server authentication. Ensure "SQL Server and Windows Authentication mode" is selected.
45-
run: flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} migrate -cleanDisabled="false" -user=${{ env.DB_USER_Build }} -password=${{ env.DB_USER_PW_Build }} -url=${{ env.JDBC_BUILD }} -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
45+
run: flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} migrate -cleanDisabled="false" -user=${{ env.DB_USER_BUILD }} -password=${{ env.DB_USER_PW_BUILD }} -url=${{ env.JDBC_BUILD }} -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
4646
working-directory: ./migrations
4747

4848
- name: Rollback Build # Step to run Flyway migrations
49-
run: flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} undo -cleanDisabled="false" -user=${{ env.DB_USER_Build }} -password=${{ env.DB_USER_PW_Build }} -url=${{ env.JDBC_BUILD }} -target=${{ env.FIRST_UNDO_SCRIPT }} -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
49+
run: flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} undo -cleanDisabled="false" -user=${{ env.DB_USER_BUILD }} -password=${{ env.DB_USER_PW_BUILD }} -url=${{ env.JDBC_BUILD }} -target=${{ env.FIRST_UNDO_SCRIPT }} -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
5050
working-directory: ./migrations

github-actions/workflows/deploy-prod.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ env:
1313
JDBC_PROD1: ${{ vars.JDBC_PROD1 }}
1414
JDBC_PROD2: ${{ vars.JDBC_PROD2 }}
1515
JDBC_CHECK: ${{ vars.JDBC_CHECK }}
16-
DB_PROD_2: ${{ vars.DB_NAME_PROD_2 }} # Used in report filename
16+
DB_PROD_1: ${{ vars.DB_NAME_PROD_1 }} # Used in report filename
1717

1818
# Repository Secrets - Create these in Project Settings > Secrets > Actions
1919
TOKEN: ${{ secrets.FLYWAY_TOKEN }}
20-
DB_USER_PROD: ${{ secrets.DB_USER_NAME_QA }}
21-
DB_USER_PW_PROD: ${{ secrets.DB_USER_PW_QA }}
20+
DB_USER_PROD: ${{ secrets.DB_USER_NAME_PROD1 }}
21+
DB_USER_PW_PROD: ${{ secrets.DB_USER_PW_PROD1 }}
22+
# If PROD2 needs a different User & Password input here and replace paramaters in flyway-deploy-prod-2 run step.
2223
# End of Environment Secrets #
2324

2425
generateDriftAndChangeReport: true
@@ -43,7 +44,7 @@ jobs:
4344

4445
- name: Create Drift and Change Report
4546
run: |
46-
flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} check -code -changes -drift -dryrun -cleanDisabled="false" -user=${{ env.DB_USER_PROD }} -password=${{ env.DB_USER_PW_PROD }} -url=${{ env.JDBC_PROD2 }} -check.buildUser=${{ env.DB_USER_PROD }} -check.buildPassword=${{ env.DB_USER_PW_PROD }} -check.buildUrl="${{ env.JDBC_CHECK }}" -reportFilename="${{ github.workspace }}\reports\${{ env.DB_PROD_2 }}-Run-${{ github.run_id }}-Check-Report.html" -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}\migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
47+
flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} check -code -changes -drift -dryrun -cleanDisabled="false" -user=${{ env.DB_USER_PROD }} -password=${{ env.DB_USER_PW_PROD }} -url=${{ env.JDBC_PROD2 }} -check.buildUser=${{ env.DB_USER_PROD }} -check.buildPassword=${{ env.DB_USER_PW_PROD }} -check.buildUrl="${{ env.JDBC_CHECK }}" -reportFilename="${{ github.workspace }}\reports\${{ env.DB_PROD_1 }}-Run-${{ github.run_id }}-Check-Report.html" -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}\migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
4748
continue-on-error: true
4849

4950
# Create a directory to stage the artifact files
@@ -57,7 +58,7 @@ jobs:
5758
name: flyway-reports
5859
path: reports/
5960

60-
# GitHub Actions doesn't natively support manual approval steps like some other CI/CD tools (e.g., Azure DevOps or GitLab).
61+
# GitHub Actions can support manual approval steps like some other CI/CD tools (e.g., Azure DevOps or GitLab).
6162
# You can achieve similar functionality using environments with required reviewers or by integrating external approval mechanisms.
6263
# Alternatively maybe a Review Branch prior to pulling to Production or another downstream environment.
6364

0 commit comments

Comments
 (0)