-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (117 loc) · 5.19 KB
/
release-main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# This worflow creates a release based on main branch
name: Release Main
# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the main branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
release:
runs-on: windows-latest
env:
SigningCertificate: JumpPoint_Certificate.pfx
SolutionPath: JumpPoint\JumpPoint.sln
PackagingProjectDirectory: JumpPoint\JumpPoint.Package
PackagingProject: JumpPoint.Package.wapproj
OneDriveServiceProjectDirectory: JumpPoint\JumpPoint.Platform.Services.OneDrive
OneDriveServiceSecretsFileName: onedrive.jps.json
UwpProjectDirectory: JumpPoint\JumpPoint.Uwp
AppCenterSecretsFileName: appcenter.jps.json
AppxPackageDirectory: C:\DeployOutput
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.2
with:
minimum-size: 32GB
maximum-size: 32GB
disk-root: "C:"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Nerdbank.GitVersioning
uses: dotnet/nbgv@v0.4.0
with:
setAllVars: true
- name: Get Version
id: get-version
run: |
echo "::set-output name=fullVersion::v${{ env.NBGV_SimpleVersion }}.0"
echo "::set-output name=version::${{ env.NBGV_SimpleVersion }}.0"
echo "::set-output name=fullName::JumpPoint.v${{ env.NBGV_SimpleVersion }}.0.Store"
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.0
- name: Update manifest version
run: |
[xml]$manifest = get-content ".\$env:PackagingProjectDirectory\Package.appxmanifest"
$manifest.Package.Identity.Version = "${{ steps.get-version.outputs.version }}"
$manifest.save(".\$env:PackagingProjectDirectory\Package.appxmanifest")
- name: Jump Point secrets
run: |
$currentDirectory = Get-Location
# Signing Certificate
$base64Pfx = [System.Convert]::FromBase64String("${{ secrets.STORE_BASE64_PFX }}")
$certificatePath = Join-Path -Path $currentDirectory -ChildPath $env:PackagingProjectDirectory -AdditionalChildPath $env:SigningCertificate
[IO.File]::WriteAllBytes("$certificatePath", $base64Pfx)
# OneDrive Service
$secretsPath = Join-Path -Path $currentDirectory -ChildPath $env:OneDriveServiceProjectDirectory -AdditionalChildPath $env:OneDriveServiceSecretsFileName
$content = @"
${{ secrets.ONEDRIVE_SERVICE }}
"@
[IO.File]::WriteAllText("$secretsPath", "$content")
# App Center
$secretsPath = Join-Path -Path $currentDirectory -ChildPath $env:UwpProjectDirectory -AdditionalChildPath $env:AppCenterSecretsFileName
$content = @"
${{ secrets.APPCENTER }}
"@
[IO.File]::WriteAllText("$secretsPath", "$content")
- name: Build the solution
run: msbuild $env:SolutionPath /p:Platform=$env:Platform /p:AppxBundle=$env:AppxBundle /p:AppxBundlePlatforms=$env:AppxBundlePlatforms /p:UapAppxPackageBuildMode=$env:BuildMode /p:Configuration=$env:Configuration /p:GenerateAppInstallerFile=$env:GenerateAppInstallerFile /p:AppxPackageDir=$env:AppxPackageDirectory /p:AppxPackageSigningEnabled=False /restore
env:
Platform: x86
AppxBundle: Always
AppxBundlePlatforms: x86|x64|ARM|ARM64
BuildMode: StoreUpload # Generate the .msixupload file and test folder
Configuration: Release
GenerateAppInstallerFile: False
- name: Cleanup secrets
run: |
Remove-Item -path $env:PackagingProjectDirectory/$env:SigningCertificate
Remove-Item -path $env:OneDriveServiceProjectDirectory/$env:OneDriveServiceSecretsFileName
Remove-Item -path $env:UwpProjectDirectory/$env:AppCenterSecretsFileName
- name: Create archive
run: Compress-Archive -Path $env:AppxPackageDirectory\* -DestinationPath $env:AppxPackageDirectory\${{ steps.get-version.outputs.fullName }}.zip
- name: Create tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${process.steps.get-version.outputs.fullVersion}"
sha: context.sha
})
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get-version.outputs.fullVersion }}
release_name: ${{ steps.get-version.outputs.fullName }}
draft: true
prerelease: false
- name: Upload release
id: upload-release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ env.AppxPackageDirectory }}\${{ steps.get-version.outputs.fullName }}.zip
asset_name: ${{ steps.get-version.outputs.fullName }}.zip
asset_content_type: application/zip