5. Release to Test
LAB SCENARIO
Working as part of the PrioritZ fusion team you will be configuring GitHub Actions using the Power Platform Build Tools to automate the team’s deployments.
In Exercise 5 you will create a workflow action and add steps that will release the solution you exported to the test environment.
Important
You will need GitHub account in this lab
5.1 Create workflow
👉 the Actions tab. 👉 New workflow. 👉 set up a workflow yourself.
Change the file name to it
release-to-test.yml
. Add the following trigger. This will trigger on creation of a new release.
Note
Source Code available here
on:
release:
types: [created]
- Define constants. Add the below
YAML
snippet.
env:
solution_name: Prioritz
solution_source_folder: solutions
solution_outbound_folder: out/solutions
solution_release_folder: out/release
- Add job and steps. Add the below YAML snippet.
jobs:
convert-to-managed:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true
- Package managed solution. Add the below YAML snippet. This will take the individual files and put them in a compressed file that can be deployed.
- name: Pack managed solution
uses: microsoft/powerplatform-actions/pack-solution@v0
with:
solution-folder: ${{ env.solution_source_folder}}/${{ env.solution_name }}
solution-file: ${{ env.solution_outbound_folder}}/${{ env.solution_name }}_managed.zip
solution-type: Managed
- Package unmanaged solution. Add the below YAML snippet.
- name: Pack unmanaged solution
uses: microsoft/powerplatform-actions/pack-solution@v0
with:
solution-folder: ${{ env.solution_source_folder}}/${{ env.solution_name }}
solution-file: ${{ env.solution_outbound_folder}}/${{ env.solution_name }}_unmanaged.zip
solution-type: Unmanaged
- Upload solution artifacts. Add the below YAML snippet.
- name: Upload the unmanaged solution to GH artifact store
uses: actions/upload-artifact@v2
with:
name: unmanagedSolutions
path: ${{ env.solution_outbound_folder}}/${{ env.solution_name }}_unmanaged.zip
- name: Upload the managed solution to GH artifact store
uses: actions/upload-artifact@v2
with:
name: managedSolutions
path: ${{ env.solution_outbound_folder}}/${{ env.solution_name }}_managed.zip
- Release to staging. Add the below YAML snippet. This defines a second job to deploy.
release-to-staging:
needs: [ convert-to-managed ]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true
- Download artifacts. Add the below YAML snippet.
name: Fetch the ready to ship solution from GH artifact store
uses: actions/download-artifact@v2
with:
name: managedSolutions
path: ${{ env.solution_release_folder}}
- Import the managed solution to the test environment. Add the below YAML snippet.
name: Import solution to prod env
uses: microsoft/powerplatform-actions/import-solution@v0
with:
environment-url: ${{secrets.PowerPlatformTestUrl}}
app-id: ${{secrets.PowerPlatformAppID}}
client-secret: ${{ secrets.PowerPlatformClientSecret }}
tenant-id: ${{secrets.PowerPlatformTenantID}}
solution-file: ${{ env.solution_release_folder}}/${{ env.solution_name }}_managed.zip
run-asynchronously: true
3.2 Commit and Publish
- Click Start commit and then click Commit new file.
- 👉 the Code tab.👉 Releases section and 👉 Create new release.
- Click on the Choose a tag button, enter v1.0.0, and select + Create new tag on publish.
- Click Publish release.
- Select the Actions tab and monitor the workflow.
Note
The release should complete successfully. Check your test environment and you should see the solution deployed.