|
| 1 | +# This workflow will build the PCF control, pack the solution and create a release |
| 2 | +# Note: The folder solution_package contains the full solution including the forms and PCF control |
| 3 | + |
| 4 | +name: Build |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ dev, master ] |
| 9 | + pull_request: |
| 10 | + branches: [ dev, master ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + |
| 15 | + runs-on: windows-latest |
| 16 | + env: |
| 17 | + MajorVersion: 1 |
| 18 | + MinorVersion: 1 |
| 19 | + BuildVersion: ${{ github.run_number }} |
| 20 | + |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + node-version: [12.x] |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Setup Node |
| 30 | + uses: actions/setup-node@v1 |
| 31 | + with: |
| 32 | + node-version: ${{ matrix.node-version }} |
| 33 | + |
| 34 | + - name: Install Dependencies |
| 35 | + run: npm ci |
| 36 | + working-directory: "./NetworkViewPCF" |
| 37 | + |
| 38 | + - name: Build |
| 39 | + run: dotnet msbuild "NetworkView2Solution.cdsproj" /t:build /restore /p:configuration=Release |
| 40 | + working-directory: "./NetworkViewPCFSolution" |
| 41 | + |
| 42 | + - name: Install PreProcess Script Dependencies |
| 43 | + run: npm ci |
| 44 | + working-directory: "./build-scripts" |
| 45 | + |
| 46 | + - name: PreProcess Solution Package |
| 47 | + uses: actions/github-script@v2 |
| 48 | + with: |
| 49 | + script: | |
| 50 | + const script = require(`${process.env.GITHUB_WORKSPACE}/build-scripts/preprocess-solution.js`) |
| 51 | + script({ |
| 52 | + majorVersion: ${{ env.MajorVersion }}, |
| 53 | + minorVersion: ${{ env.MinorVersion }}, |
| 54 | + buildVersion: ${{ env.BuildVersion }}, |
| 55 | + github, |
| 56 | + context}) |
| 57 | + |
| 58 | + - name: Pack solution |
| 59 | + uses: microsoft/powerplatform-actions/pack-solution@latest |
| 60 | + with: |
| 61 | + solution-folder: 'NetworkViewPCFSolution/solution_package' |
| 62 | + solution-file: out/NetworkView_managed.zip |
| 63 | + solution-type: Managed |
| 64 | + |
| 65 | + - name: Solution Artifact |
| 66 | + if: endsWith(github.ref, '/dev') |
| 67 | + uses: actions/upload-artifact@v2 |
| 68 | + with: |
| 69 | + path: out/NetworkView_managed.zip |
| 70 | + |
| 71 | + - name: Create Release |
| 72 | + if: endsWith(github.ref, '/master') |
| 73 | + id: create_release |
| 74 | + uses: actions/create-release@v1 |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + with: |
| 78 | + tag_name: v${{ env.MajorVersion }}.${{ env.MinorVersion }}.${{ env.BuildVersion }} |
| 79 | + release_name: Release v${{ env.MajorVersion }}.${{ env.MinorVersion }}.${{ env.BuildVersion }} |
| 80 | + draft: false |
| 81 | + prerelease: false |
| 82 | + |
| 83 | + - name: Upload Release Asset |
| 84 | + if: endsWith(github.ref, '/master') |
| 85 | + id: upload-release-asset |
| 86 | + uses: actions/upload-release-asset@v1 |
| 87 | + env: |
| 88 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + with: |
| 90 | + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps |
| 91 | + asset_path: out/NetworkView_managed.zip |
| 92 | + asset_name: NetworkView_managed.zip |
| 93 | + asset_content_type: application/zip |
| 94 | + |
| 95 | + |
| 96 | + |
0 commit comments