forked from ml0130/vatis
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (98 loc) · 3.48 KB
/
build.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
name: Build Client
on:
workflow_dispatch:
push:
tags:
- 'v*'
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
TEST_VERSION: ${{ !startsWith(github.ref, 'refs/tags/v') }}
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Build client
working-directory: ./Vatsim.Vatis
run: |
dotnet publish --runtime win-x64 --self-contained true --configuration Release -p:PublishReadyToRun=true --output ./publish
$hash = (Get-FileHash .\publish\vATIS.exe -Algorithm SHA256).Hash.ToLower()
echo "CLIENT_HASH=$hash" >> $env:GITHUB_ENV
$path = ls .\publish\vATIS.dll | select -First 1 | % fullname
$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($path).ProductVersion
echo "CLIENT_VER=$version" >> $env:GITHUB_ENV
"!define Version ""$version""" | Out-File -FilePath ..\Installer\Version.txt
- name: Checkout auth repository
uses: actions/checkout@v3
with:
repository: vatis-project/auth
path: auth
token: ${{ secrets.GH_TOKEN }}
- name: Build auth library
working-directory: auth
run: |
cmake -E make_directory build
cd build
cmake .. -DCLIENT_HASH=${{ env.CLIENT_HASH }} -DVATSIM_CLIENT_ID=${{ secrets.CLIENT_ID }} -DVATSIM_CLIENT_KEY=${{ secrets.CLIENT_KEY }} -DTEST_VERSION=${{ env.TEST_VERSION }}
cmake --build . --config RelWithDebInfo
Copy-Item -Path .\RelWithDebInfo\VatsimAuth.dll -Destination ..\..\Vatsim.Vatis\publish\
- name: Create installer
uses: joncloud/makensis-action@v4
with:
script-file: '.\Installer\installer.nsi'
- name: Create updater
uses: joncloud/makensis-action@v4
with:
script-file: '.\Installer\updater.nsi'
- name: Move installer
working-directory: Installer
shell: bash
run: |
mv vATIS-Setup-${{ env.CLIENT_VER }}.exe ..
- name: Move updater
working-directory: Installer
shell: bash
run: |
mv vATIS-Update-${{ env.CLIENT_VER }}.exe ..
- name: Upload installer
uses: actions/upload-artifact@v3
with:
name: vATIS-Setup-${{ env.CLIENT_VER }}
path: vATIS-Setup-${{ env.CLIENT_VER }}.exe
- name: Upload updater
uses: actions/upload-artifact@v3
with:
name: vATIS-Update-${{ env.CLIENT_VER }}
path: vATIS-Update-${{ env.CLIENT_VER }}.exe
- name: Get version
id: get_version
uses: battila7/get-version-action@v2
- name: Create release notes
shell: bash
run: |
cat > CHANGELOG.txt << EOF
🔗 [Download vATIS](https://github.com/vatis-project/vatis/releases/download/${{ steps.get_version.outputs.version }}/vATIS-Setup-${{ env.CLIENT_VER }}.exe)
---
### Added
### Changed
### Fixed
EOF
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
name: vATIS ${{ env.CLIENT_VER }}
prerelease: true
draft: true
body_path: CHANGELOG.txt
files: |
vATIS-Setup-${{ env.CLIENT_VER }}.exe
vATIS-Update-${{ env.CLIENT_VER }}.exe