|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: CI |
| 4 | + |
| 5 | +# Controls when the action will run. |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the master branch |
| 8 | + push: |
| 9 | + branches: [master] |
| 10 | + pull_request: |
| 11 | + branches: [master] |
| 12 | + |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 17 | +jobs: |
| 18 | + # This workflow contains a single job called "build" |
| 19 | + build: |
| 20 | + # The type of runner that the job will run on |
| 21 | + runs-on: windows-latest |
| 22 | + |
| 23 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 24 | + steps: |
| 25 | + - name: Configure page file |
| 26 | + uses: al-cheb/configure-pagefile-action@master |
| 27 | + with: |
| 28 | + minimum-size: 32GB |
| 29 | + maximum-size: 32GB |
| 30 | + disk-root: "C:" |
| 31 | + |
| 32 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 33 | + - uses: actions/checkout@master |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + |
| 37 | + # Use Nerdbank.GitVersioning to set version variables: https://github.com/AArnott/nbgv |
| 38 | + - name: Generate build version |
| 39 | + id: generate-version |
| 40 | + uses: aarnott/nbgv@master |
| 41 | + with: |
| 42 | + setAllVars: true |
| 43 | + |
| 44 | + - name: Update manifest |
| 45 | + run: | |
| 46 | + $path = "${{github.workspace}}/src/Main/Package.appxmanifest" |
| 47 | + $version = "${{steps.generate-version.outputs.Version}}" |
| 48 | + [xml] $manifest = Get-Content $path |
| 49 | + $manifest.Package.Identity.Version = $version |
| 50 | + $manifest.Save($path) |
| 51 | +
|
| 52 | + - name: Generate certificate file |
| 53 | + run: | |
| 54 | + $certificate = [System.Convert]::FromBase64String("${{secrets.BASE64_ENCODED_PFX}}") |
| 55 | + $path = "${{github.workspace}}/src/Main/Main_TemporaryKey.pfx" |
| 56 | + [IO.File]::WriteAllBytes($path, $certificate) |
| 57 | +
|
| 58 | + # Add MsBuild to the PATH: https://github.com/microsoft/setup-msbuild |
| 59 | + - name: Setup MSBuild |
| 60 | + uses: microsoft/setup-msbuild@v1.0.2 |
| 61 | + |
| 62 | + - name: Build the solution |
| 63 | + run: | |
| 64 | + $certificate = "Main_TemporaryKey.pfx" |
| 65 | + $solution = "Starter.sln" |
| 66 | + msbuild $solution -p:AppxPackageSigningEnabled=True -p:Configuration=Release -p:PackageCertificateKeyFile=$certificate -p:Platform=x64 |
| 67 | +
|
| 68 | + - name: Remove certificate file |
| 69 | + run: | |
| 70 | + $path = "${{github.workspace}}/src/Main/Main_TemporaryKey.pfx" |
| 71 | + Remove-Item -path $path |
| 72 | +
|
| 73 | + - name: Create artifacts |
| 74 | + run: | |
| 75 | + $destination = "${{github.workspace}}/src/Main/AppPackages/Main_${{steps.generate-version.outputs.Version}}.zip" |
| 76 | + $source = "${{github.workspace}}/src/Main/AppPackages/*" |
| 77 | + Compress-Archive -Path $source -DestinationPath $destination |
| 78 | +
|
| 79 | + - name: Create release |
| 80 | + id: create-release |
| 81 | + uses: actions/create-release@master |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 84 | + with: |
| 85 | + tag_name: v${{steps.generate-version.outputs.Version}} |
| 86 | + release_name: RC ${{steps.generate-version.outputs.Version}} |
| 87 | + draft: false |
| 88 | + prerelease: false |
| 89 | + |
| 90 | + - name: Upload packages |
| 91 | + uses: actions/upload-release-asset@master |
| 92 | + env: |
| 93 | + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 94 | + with: |
| 95 | + asset_content_type: application/zip |
| 96 | + asset_name: "Main_${{steps.generate-version.outputs.Version}}.zip" |
| 97 | + asset_path: "${{github.workspace}}/src/Main/AppPackages/Main_${{steps.generate-version.outputs.Version}}.zip" |
| 98 | + upload_url: "${{steps.create-release.outputs.upload_url}}" |
0 commit comments