Skip to content

Commit c5632c9

Browse files
authored
Update deploy-build.yml
Consolidating variables into a single JDBC connection.
1 parent b8842b5 commit c5632c9

File tree

1 file changed

+35
-42
lines changed

1 file changed

+35
-42
lines changed

github-actions/workflows/deploy-build.yml

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,47 @@ on:
44
branches:
55
- Development
66
paths:
7-
- 'migrations/**'
7+
- "migrations/**"
88

99
# Environment Variables
1010
env:
11-
# Repository Variables - Create these in Project Settings > Variables > Actions
12-
EMAIL: ${{ vars.USER_EMAIL }} # Use with ${{ env.EMAIL }}
13-
DB_SERVER: ${{ vars.DB_SERVER }}
14-
DB_Build: ${{ vars.DB_NAME_Build }}
15-
ENCRYPT: ${{ vars.ENCRYPT_BOOL }}
16-
TRUST_CERT: ${{ vars.TRUST_CERT_BOOL }}
17-
# BASELINE_VERSION: ${{ vars.BASELINE_VERSION }}
18-
19-
# Repository Secrets - Create these in Project Settings > Secrets > Actions
20-
TOKEN: ${{ secrets.FLYWAY_TOKEN }}
21-
DB_USER_Build: ${{ secrets.DB_USER_NAME_QA }}
22-
DB_USER_PW_Build: ${{ secrets.DB_USER_PW_QA }}
23-
FIRST_UNDO_SCRIPT: ${{ secrets.FIRST_UNDO_SCRIPT }} # Validates all undo scripts up to and including the specified script
24-
11+
# Repository Variables - Create these in Project Settings > Variables > Actions
12+
EMAIL: ${{ vars.USER_EMAIL }} # Use with ${{ env.EMAIL }}
13+
JDBC_BUILD: ${{ vars.JDBC_BUILD }}
14+
# BASELINE_VERSION: ${{ vars.BASELINE_VERSION }}
2515

16+
# Repository Secrets - Create these in Project Settings > Secrets > Actions
17+
TOKEN: ${{ secrets.FLYWAY_TOKEN }}
18+
DB_USER_Build: ${{ secrets.DB_USER_NAME_QA }}
19+
DB_USER_PW_Build: ${{ secrets.DB_USER_PW_QA }}
20+
FIRST_UNDO_SCRIPT: ${{ secrets.FIRST_UNDO_SCRIPT }} # Validates all undo scripts up to and including the specified script
2621

2722
# jobs are the steps executed in the workflow
2823
jobs:
29-
flyway-build: # Job name
30-
runs-on: self-hosted # Runner to execute the job
31-
# runs-on: ubuntu-latest
32-
defaults:
33-
run:
34-
shell: cmd # Default shell. Use Windows Command Prompt
35-
36-
steps: # Steps are the individual tasks that are executed in the job
37-
- name: Checkout Repository # Step to check out the repository
38-
uses: actions/checkout@v4
39-
with:
40-
ref: "Development" # Branch to check out
41-
fetch-depth: 0 # Fetch the entire history to avoid shallow clone issues
42-
clean: true # Ensure the repository is cleaned before the workflow runs
24+
flyway-build: # Job name
25+
runs-on: self-hosted # Runner to execute the job
26+
# runs-on: ubuntu-latest
27+
defaults:
28+
run:
29+
shell: cmd # Default shell. Use Windows Command Prompt
30+
steps: # Steps are the individual tasks that are executed in the job
31+
- name: Checkout Repository # Step to check out the repository
32+
uses: actions/checkout@v4
33+
with:
34+
ref: "Development" # Branch to check out
35+
fetch-depth: 0 # Fetch the entire history to avoid shallow clone issues
36+
clean: true # Ensure the repository is cleaned before the workflow runs
37+
38+
# Runs the Flyway Clean command against the Build database
39+
- name: Clean Build DB
40+
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-
4342
43+
- name: Migrate Build # Step to run Flyway migrations
44+
# 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-
46+
working-directory: ./migrations
4447

45-
# Runs the Flyway Clean command against the Build database
46-
- name: Clean Build DB
47-
run: |
48-
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.DB_SERVER }};databaseName=${{ env.DB_Build }};encrypt=${{ env.ENCRYPT }};trustServerCertificate=${{ env.TRUST_CERT }}" -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
49-
50-
- name: Migrate Build # Step to run Flyway migrations
51-
# 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.
52-
run: flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} migrate -cleanDisabled="false" -user=${{ env.DB_USER_Build }} -password=${{ env.DB_USER_PW_Build }} -url="${{ env.DB_SERVER }};databaseName=${{ env.DB_Build }};encrypt=${{ env.ENCRYPT }};trustServerCertificate=${{ env.TRUST_CERT }}" -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
53-
working-directory: ./migrations
54-
55-
- name: Rollback Build # Step to run Flyway migrations
56-
run: flyway -email=${{ env.EMAIL }} -token=${{ env.TOKEN }} undo -cleanDisabled="false" -user=${{ env.DB_USER_Build }} -password=${{ env.DB_USER_PW_Build }} -url="${{ env.DB_SERVER }};databaseName=${{ env.DB_Build }};encrypt=${{ env.ENCRYPT }};trustServerCertificate=${{ env.TRUST_CERT }}" -target="${{ env.FIRST_UNDO_SCRIPT }}" -IAgreeToTheEula -locations="filesystem:${{ github.workspace }}/migrations" -configFiles="${{ github.workspace }}/flyway.toml" -baselineOnMigrate=true -errorOverrides=S0001:0:I-
57-
working-directory: ./migrations
48+
- 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-
50+
working-directory: ./migrations

0 commit comments

Comments
 (0)