-
Notifications
You must be signed in to change notification settings - Fork 15
129 lines (124 loc) · 4.75 KB
/
ci.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
name: Continuous Integration
on:
push:
branches: ['main', 'stable']
pull_request:
branches: ['main', 'stable']
env:
SYMBOLS_DAYS_TO_KEEP: 14
SYMBOLS_KEEP_LAST: 10
defaults:
run:
shell: pwsh
jobs:
build:
name: Build
runs-on: windows-2022
if: |
!contains(github.event.head_commit.message, '***NO_CI***') &&
!contains(github.event.head_commit.message, '[skip ci]')
steps:
- name: Set up build environment
uses: microsoft/setup-msbuild@v1.1
- name: Set up NuGet
uses: nuget/setup-nuget@v1
- name: Checkout
uses: actions/checkout@v3
with:
path: main
submodules: recursive
fetch-depth: 0 # git complains when cloning the submodules without this
- name: Checkout branding
if:
github.repository == 'Windower/Fenestra' &&
github.event_name == 'push'
uses: actions/checkout@v3
with:
token: ${{ secrets.BRANDING_PAT }}
repository: Windower/Branding
ref: ${{ github.ref_name == 'stable' && '5.0/release' || '5.0/test' }}
path: branding
- name: Apply branding
if:
github.repository == 'Windower/Fenestra' &&
github.event_name == 'push'
run: |
Remove-Item 'branding/.git' -Recurse -Force
Copy-Item 'branding/*' 'main' -Recurse -Force
- name: Build
run: |
Set-Location main
&msbuild fenestra.sln -t:'restore;build' -p:configuration=release -m -nowarn:NU1503
&nuget restore installer.sln
&msbuild installer.sln -t:'build' -p:configuration=release -m -nowarn:NU1503
- name: Install debug tools
run: choco install windows-sdk-10-version-2004-windbg
- name: Index sources
run: |
Set-Location main
.github/workflows/index-sources
- name: Upload build artifacts
if: github.event_name == 'push'
uses: actions/upload-artifact@v3
with:
name: binaries
path: main/build/bin/release/
deploy:
name: Deploy
needs: build
runs-on: windows-2022
if: |
github.repository == 'Windower/Fenestra' &&
github.event_name == 'push'
steps:
- name: Set up SSH
run: |
# Set up SSH
Write-Output 'Starting ssh-agent service...'
Get-Service -Name 'ssh-agent' | Set-Service -StartupType Manual
Start-Service -Name 'ssh-agent'
New-Item -ItemType Directory -Force -Path '~/.ssh' *>$null
$env:SSH_KEY | &ssh-add -
&ssh-keyscan -H "$(
@($env:SSH_HOST) + (Resolve-DnsName $env:SSH_HOST).IPAddress -Join ','
)" | Add-Content '~/.ssh/known_hosts'
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_KEY: ${{ secrets.SSH_KEY }}
- name: Checkout
uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: binaries
path: artifacts
- name: Stage files
run: |
# Stage files
New-Item -ItemType Directory -Force -Path './staging/files' *>$null
Copy-Item './artifacts/windower.exe' -Destination './staging/files'
Copy-Item './artifacts/core.dll' -Destination './staging/files'
Copy-Item './artifacts/version.xml' -Destination './staging/files'
Copy-Item './artifacts/windower.msi' -Destination './staging/files'
Copy-Item './artifacts/windower.zip' -Destination './staging/files'
Copy-Item './artifacts/windower.portable.zip' -Destination './staging/files'
New-Item -ItemType Directory -Force -Path './temp/symbols' *>$null
Copy-Item './artifacts/windower.exe' -Destination './temp/symbols/'
Copy-Item './artifacts/windower.pdb' -Destination './temp/symbols/'
Copy-Item './artifacts/core.dll' -Destination './temp/symbols/'
Copy-Item './artifacts/core.pdb' -Destination './temp/symbols/'
- name: Install debug tools
run: choco install windows-sdk-10-version-2004-windbg
- name: Update symbol database
run: .github/workflows/update-symbols
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
SYMBOLS_PATH: ${{ secrets.SYMBOLS_PATH }}/${{ github.ref_name == 'stable' && 'release' || 'test' }}
- name: Deploy to server
run: .github/workflows/deploy
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
FILES_PATH: ${{ secrets.FILES_PATH }}/${{ github.ref_name == 'stable' && 'release' || 'test' }}
SYMBOLS_PATH: ${{ secrets.SYMBOLS_PATH }}/${{ github.ref_name == 'stable' && 'release' || 'test' }}