Skip to content

Commit

Permalink
Add migrations workflow and update configs
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoerdbeentjes committed Oct 2, 2024
1 parent 48b4f3f commit 0be21fe
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 8 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/main-migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Apply main migrations on PR merge

on:
pull_request:
types: [closed]

jobs:
apply-main-migrations:
if: ${{ github.event.pull_request.merged == true }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check for changes in migrations folder
id: check_changes
run: |
git fetch origin main
if git diff --quiet HEAD^ HEAD migrations; then
echo "CHANGES=false" >> $GITHUB_ENV
else
echo "CHANGES=true" >> $GITHUB_ENV
fi
- name: Set up Node.js
if: ${{ env.CHANGES == 'true' }}
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
if: ${{ env.CHANGES == 'true' }}
run: npm install --force

- name: Run TypeScript script
if: ${{ env.CHANGES == 'true' }}
env:
DATO_API_KEY_OPENEARTH_RWS_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_RWS_VIEWER }}
DATO_API_KEY_OPENEARTH_DATA_VIEWER: ${{ secrets.DATO_API_KEY_OPENEARTH_DATA_VIEWER }}
DATO_API_KEY_NL2120: ${{ secrets.DATO_API_KEY_NL2120 }}
run: npm run migrations:apply-main
16 changes: 8 additions & 8 deletions config/dato/instances.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ module.exports.instances = [
name: "nl2120",
key: process.env.DATO_API_KEY_NL2120,
},
// {
// name: "openearth-data-viewer",
// key: process.env.DATO_API_KEY_OPENEARTH_DATA_VIEWER,
// },
// {
// name: "openearth-rws-viewer",
// key: process.env.DATO_API_KEY_OPENEARTH_RWS_VIEWER,
// },
{
name: "openearth-data-viewer",
key: process.env.DATO_API_KEY_OPENEARTH_DATA_VIEWER,
},
{
name: "openearth-rws-viewer",
key: process.env.DATO_API_KEY_OPENEARTH_RWS_VIEWER,
},
];
2 changes: 2 additions & 0 deletions scripts/dato/apply-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ async function main() {
await client.destroyEnvironment("main");

await client.runCommand(["environments:rename", "staging", "main"]);

await client.runCommand(["maintenance:off"]);
}
}

Expand Down

0 comments on commit 0be21fe

Please sign in to comment.