Skip to content

Commit f0b1c21

Browse files
committed
Add GH Action to deploy data
1 parent 140f7f2 commit f0b1c21

File tree

5 files changed

+912
-3
lines changed

5 files changed

+912
-3
lines changed

.github/workflows/cd-pipeline.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: deploy workflow
5+
on:
6+
workflow_call:
7+
inputs:
8+
environment:
9+
required: true
10+
type: string
11+
12+
13+
jobs:
14+
Deployment:
15+
name: Deployment
16+
runs-on: ubuntu-latest
17+
environment:
18+
name: ${{ inputs.environment }}
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v3
24+
with:
25+
dotnet-version: 8.0.x
26+
- name: Download tool artifact
27+
uses: actions/download-artifact@v3
28+
with:
29+
name: configurationmigrationtool
30+
path: '${{ github.workspace }}/configurationmigrationtool'
31+
- name: Download data artifact
32+
uses: actions/download-artifact@v3
33+
with:
34+
name: data
35+
path: '${{ github.workspace }}/data'
36+
- name: Replace tokens
37+
uses: cschleiden/replace-tokens@v1
38+
with:
39+
tokenPrefix: '${'
40+
tokenSuffix: '}$'
41+
files: '["**/*.json"]'
42+
env:
43+
DataverseClientId: ${{ secrets.DATAVERSECLIENTID }}
44+
DataverseClientSecret: ${{ secrets.DATAVERSECLIENTSECRET }}
45+
DataverseEnvUrl: ${{ secrets.DATAVERSEENVURL }}
46+
- name: import configuration data
47+
run: |
48+
cd ${{ github.workspace }}/configurationmigrationtool/Release
49+
Dataverse.ConfigurationMigrationTool.Console.exe import --schema ${{ github.workspace }}/data/data_schema.xml --data ${{ github.workspace }}/data/data.xml
50+
env:
51+
DOTNET_ENVIRONMENT: Production
52+
53+
54+
55+
56+
57+
58+
59+

.github/workflows/main-pipeline.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: 'Main Workflow'
5+
run-name: ${{ github.event.repository.name }}_${{ github.run_number }}
6+
permissions:
7+
contents: read
8+
issues: read
9+
checks: write
10+
pull-requests: write
11+
on:
12+
workflow_dispatch:
13+
14+
env:
15+
solutionPath: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.sln'
16+
solutionFolder: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool'
17+
toolpublishlocation: '${{ github.workspace }/configurationmigrationtool'
18+
datapublishlocation: '${{ github.workspace }/data'
19+
jobs:
20+
build:
21+
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
- name: Setup .NET
29+
uses: actions/setup-dotnet@v3
30+
with:
31+
dotnet-version: 8.0.x
32+
33+
- name: Restore dependencies
34+
run: dotnet restore ${{ env.solutionPath }}
35+
- name: Build
36+
run: dotnet build ${{ env.solutionPath }} --configuration Release --no-restore
37+
- name: dotnet publish
38+
if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }}
39+
run: dotnet publish ${{ env.solutionFolder }}/Dataverse.ConfigurationMigrationTool.Console/Dataverse.ConfigurationMigrationTool.Console.csproj -c Release -o ${{env.toolpublishlocation}}
40+
- name: Upload tool artifact
41+
if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }}
42+
uses: actions/upload-artifact@v3
43+
with:
44+
name: configurationmigrationtool
45+
path: ${{env.toolpublishlocation}}
46+
- name: Upload data artifact
47+
if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }}
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: data
51+
path: ${{env.datapublishlocation}}
52+
53+
deployStaging:
54+
name: 'staging'
55+
needs: build
56+
uses: ./.github/workflows/cd-pipeline.yml
57+
if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }}
58+
with:
59+
environment: 'staging'
60+
61+
62+
63+
64+
65+
66+
67+

0 commit comments

Comments
 (0)