diff --git a/.github/workflows/cd-pipeline.yml b/.github/workflows/cd-pipeline.yml new file mode 100644 index 0000000..187086f --- /dev/null +++ b/.github/workflows/cd-pipeline.yml @@ -0,0 +1,59 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: deploy workflow +on: + workflow_call: + inputs: + environment: + required: true + type: string + + +jobs: + Deployment: + name: Deployment + runs-on: ubuntu-latest + environment: + name: ${{ inputs.environment }} + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + - name: Download tool artifact + uses: actions/download-artifact@v3 + with: + name: configurationmigrationtool + path: '${{ github.workspace }}/configurationmigrationtool' + - name: Download data artifact + uses: actions/download-artifact@v3 + with: + name: data + path: '${{ github.workspace }}/data' + - name: Replace tokens + uses: cschleiden/replace-tokens@v1 + with: + tokenPrefix: '${' + tokenSuffix: '}$' + files: '["**/*.json"]' + env: + DataverseClientId: ${{ secrets.DATAVERSECLIENTID }} + DataverseClientSecret: ${{ secrets.DATAVERSECLIENTSECRET }} + DataverseEnvUrl: ${{ secrets.DATAVERSEENVURL }} + - name: import configuration data + run: | + cd ${{ github.workspace }}/configurationmigrationtool/Release + Dataverse.ConfigurationMigrationTool.Console.exe import --schema ${{ github.workspace }}/data/data_schema.xml --data ${{ github.workspace }}/data/data.xml + env: + DOTNET_ENVIRONMENT: Production + + + + + + + + \ No newline at end of file diff --git a/.github/workflows/main-pipeline.yml b/.github/workflows/main-pipeline.yml new file mode 100644 index 0000000..16ec3f3 --- /dev/null +++ b/.github/workflows/main-pipeline.yml @@ -0,0 +1,67 @@ +# This workflow will build a .NET project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net + +name: 'Main Workflow' +run-name: ${{ github.event.repository.name }}_${{ github.run_number }} +permissions: + contents: read + issues: read + checks: write + pull-requests: write +on: + workflow_dispatch: + +env: + solutionPath: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.sln' + solutionFolder: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool' + toolpublishlocation: '${{ github.workspace }/configurationmigrationtool' + datapublishlocation: '${{ github.workspace }/data' +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + run: dotnet restore ${{ env.solutionPath }} + - name: Build + run: dotnet build ${{ env.solutionPath }} --configuration Release --no-restore + - name: dotnet publish + if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }} + run: dotnet publish ${{ env.solutionFolder }}/Dataverse.ConfigurationMigrationTool.Console/Dataverse.ConfigurationMigrationTool.Console.csproj -c Release -o ${{env.toolpublishlocation}} + - name: Upload tool artifact + if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }} + uses: actions/upload-artifact@v3 + with: + name: configurationmigrationtool + path: ${{env.toolpublishlocation}} + - name: Upload data artifact + if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }} + uses: actions/upload-artifact@v3 + with: + name: data + path: ${{env.datapublishlocation}} + + deployStaging: + name: 'staging' + needs: build + uses: ./.github/workflows/cd-pipeline.yml + if: ${{ (github.ref == 'refs/heads/main' || contains(github.ref, 'release')) && github.event_name != 'pull_request' }} + with: + environment: 'staging' + + + + + + + + \ No newline at end of file diff --git a/data/data.xml b/data/data.xml new file mode 100644 index 0000000..edb2211 --- /dev/null +++ b/data/data.xml @@ -0,0 +1,671 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6efe7cda-9d4f-f011-877b-6045bdccf7ac + + + + + 6efe7cda-9d4f-f011-877b-6045bdccf7ac + + + + + 6afe7cda-9d4f-f011-877b-6045bdccf7ac + 6efe7cda-9d4f-f011-877b-6045bdccf7ac + + + + + 6efe7cda-9d4f-f011-877b-6045bdccf7ac + + + + + 6afe7cda-9d4f-f011-877b-6045bdccf7ac + 6efe7cda-9d4f-f011-877b-6045bdccf7ac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/data_schema.xml b/data/data_schema.xml new file mode 100644 index 0000000..96d21bd --- /dev/null +++ b/data/data_schema.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.Console/appsettings.Production.json b/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.Console/appsettings.Production.json index c7da1be..6e0f2f7 100644 --- a/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.Console/appsettings.Production.json +++ b/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.Console/appsettings.Production.json @@ -1,7 +1,7 @@ { "Dataverse": { - "ClientId": "SHOULD BE PROVIDED BY PIPELINE", - "ClientSecret": "SHOULD BE PROVIDED BY PIPELINE", - "Url": "SHOULD BE PROVIDED BY PIPELINE" + "ClientId": "${DataverseClientId}$", + "ClientSecret": "${DataverseClientSecret}$", + "Url": "${DataverseEnvUrl}$" } }