Skip to content

Added deployment phase. #17

Added deployment phase.

Added deployment phase. #17

name: Export And Deploy
run-name: Exporting ${{ github.event.inputs.solution_name }} from ${{ github.event.inputs.source_powerplatform_environment }} and deploying to ${{ github.event.inputs.target_powerplatform_environment }} environment.
on:
workflow_dispatch:
inputs:
solution_name:
description: "Name of the Solution in Dataverse environment"
required: true
source_powerplatform_environment:
description: "URL for the source Power Platform Environment"
required: true
target_powerplatform_environment:
description: "URL for the target Power Platform Environment"
required: false
jobs:
export-solution:
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:

Check failure on line 24 in .github/workflows/auto-export-and-deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/auto-export-and-deploy.yml

Invalid workflow file

You have an error in your yaml syntax on line 24
- id: date
name: Get current datetime
run: |
$datetime = $(Get-Date -Format "yyyy-MM-ddTHH:mm:ss")
echo "::set-output name=datetime::$datetime"
- name: Setup .NET Core environment
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'
- name: Install PAC CLI
run: |
dotnet tool install --global Microsoft.PowerApps.CLI.Tool
- name: Auth with Source Environment
run: |
pac auth clear
pac auth create --url ${{ github.event.inputs.source_powerplatform_environment }} --username ${{ secrets.POWERPLATFORM_USERNAME }} --password ${{ secrets.POWERPLATFORM_PASSWORD }}
env:
POWERPLATFORM_URL: ${{ github.event.inputs.source_powerplatform_environment }}
POWERPLATFORM_USERNAME: ${{ secrets.POWERPLATFORM_USERNAME }}
POWERPLATFORM_PASSWORD: ${{ secrets.POWERPLATFORM_PASSWORD }}
- id: solution_versioning
name: Get current version number
run: |
# First we need to get the current online version.
$output = pac solution list
echo $output
$lines = $output -split "`n"
$versionLine = $lines | Where-Object { $_ -match "${{ github.event.inputs.solution_name }}" }
$version = ($versionLine -split "\s+")[3]
echo "::set-output name=current_version::$version"
# Split the version into its components
$versionParts = $version.Split('.')
# Increment the patch version
$patch = [int]$versionParts[3] + 1
# Reconstruct the version
$newVersion = "{0}.{1}.{2}.{3}" -f $versionParts[0], $versionParts[1], $versionParts[2], $patch
echo "::set-output name=new_version::$newVersion"
$newVersionWithUnderscores = "{0}_{1}_{2}_{3}" -f $versionParts[0], $versionParts[1], $versionParts[2], $patch
echo "::set-output name=new_version_with_underscores::$newVersionWithUnderscores"
- name: Increment the online version
run: pac solution online-version --solution-name "${{ github.event.inputs.solution_name }}" --solution-version ${{ steps.solution_versioning.outputs.new_version }}
- name: Export unmanaged solution
run: pac solution export --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_unmanaged.zip" --name "${{ github.event.inputs.solution_name }}" --include general
- name: Export managed solution
run: pac solution export --path "${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed.zip" --name "${{ github.event.inputs.solution_name }}" --managed --include general
- name: Publish unmanaged artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_unmanaged
path: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_unmanaged.zip
- name: Publish managed artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed
path: ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed.zip
- name: Auth with Source Environment
run: |
pac auth clear
pac auth create --url ${{ github.event.inputs.target_powerplatform_environment }} --username ${{ secrets.POWERPLATFORM_USERNAME }} --password ${{ secrets.POWERPLATFORM_PASSWORD }}
env:
POWERPLATFORM_URL: ${{ github.event.inputs.target_powerplatform_environment }}
POWERPLATFORM_USERNAME: ${{ secrets.POWERPLATFORM_USERNAME }}
POWERPLATFORM_PASSWORD: ${{ secrets.POWERPLATFORM_PASSWORD }}
- name: Deploy Managed version To Target Environment
run: |
pac solution import -–path ${{ github.event.inputs.solution_name }}_${{ steps.solution_versioning.outputs.new_version_with_underscores }}_managed.zip -–activate-plugins -–publish-changes