1- name : Migrate one record from v1 to v2
2- description : |
3- This workflow fetches a record from the v1 API, transforms it, and imports the result to v2.
4- It is designed for test & development purposes.
1+ name : Migrate all records of an event from v1 to v2 (Production)
52
63on :
74 workflow_dispatch :
85 inputs :
9- record_id :
10- description : ' The record ID to process'
6+ environment :
7+ description : ' Environment to run migration in'
8+ required : true
9+ type : choice
10+ default : ' staging'
11+ options :
12+ - staging
13+ - production
14+ event :
15+ description : ' The event to process (birth or death)'
1116 required : true
1217 type : string
1318 domain :
1419 description : ' The environment domain (without protocol or subdomains)'
1520 required : true
1621 type : string
17- default : ' farajaland-qa .opencrvs.org'
22+ default : ' farajaland.opencrvs.org'
1823
1924jobs :
20- fetch-and-transform :
21- name : Migrate ${{ github.event.inputs.record_id }} in ${{ github.event.inputs.domain }}
25+ migrate :
26+ name : Migrate ${{ github.event.inputs.event }} in ${{ github.event.inputs.environment }} (${{ github.event.inputs. domain }})
2227 runs-on : ubuntu-latest
28+ environment : ${{ github.event.inputs.environment }}
2329 outputs :
2430 script_output : ${{ steps.deno-script.outputs.script_output }}
2531 steps :
2632 - name : Checkout repository
27- uses : actions/checkout@v4
33+ uses : actions/checkout@v6
34+ with :
35+ ref : ${{ github.ref }}
36+
37+ # ADD VPN SETUP STEPS HERE
2838
2939 - name : Install dependencies
3040 run : |
@@ -36,13 +46,19 @@ jobs:
3646 - name : Convert notebook to TypeScript
3747 run : |
3848 mkdir -p tmp
39- bash ./scripts/deno-notebook-to-deno.sh ./v1-to-v2-data-migration/fetch-and-transform .ipynb ./tmp/fetch-and-transform .ts
49+ bash ./scripts/deno-notebook-to-deno.sh ./v1-to-v2-data-migration/migrate .ipynb ./tmp/migrate .ts
4050
4151 - name : Run the script with Deno
4252 id : deno-script
53+ env :
54+ OPENCRVS_EVENT : ${{ github.event.inputs.event }}
55+ OPENCRVS_DOMAIN : ${{ github.event.inputs.domain }}
56+ OPENCRVS_CLIENT_ID : ${{ secrets.OPENCRVS_CLIENT_ID }}
57+ OPENCRVS_CLIENT_SECRET : ${{ secrets.OPENCRVS_CLIENT_SECRET }}
4358 run : |
59+ set -o pipefail
4460 echo "script_output<<EOF" >> $GITHUB_OUTPUT
45- deno run --allow-net ./tmp/fetch-and-transform .ts ${{ github.event.inputs.record_id }} ${{ github.event.inputs.domain }} | tee /dev/stderr >> $GITHUB_OUTPUT
61+ deno run --allow-net --allow-env ./tmp/migrate .ts | tee /dev/stderr >> $GITHUB_OUTPUT
4662 echo "EOF" >> $GITHUB_OUTPUT
4763
4864 - name : Generate summary
5167 echo "" >> $GITHUB_STEP_SUMMARY
5268 echo "" >> $GITHUB_STEP_SUMMARY
5369 echo "${{ steps.deno-script.outputs.script_output }}" >> $GITHUB_STEP_SUMMARY
54-
55-
0 commit comments