Skip to content

Commit 26fe08f

Browse files
jingkecnJing KE
authored andcommitted
Create main.yml
1 parent 6a7d043 commit 26fe08f

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,6 @@ csharp_using_directive_placement = outsi
9191

9292
[*.vb]
9393
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async : suggestion
94+
95+
[*.{yaml, yml}]
96+
indent_size = 2

.github/workflows/main.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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}}"

version.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3+
"publicReleaseRefSpec": [
4+
"^refs/heads/master$",
5+
"^refs/heads/develop$",
6+
"^refs/heads/rel/v\\d+\\.\\d+"
7+
],
8+
"version": "1.0"
9+
}

0 commit comments

Comments
 (0)