-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (70 loc) · 2.54 KB
/
Copy pathupload-build.yml
File metadata and controls
82 lines (70 loc) · 2.54 KB
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
name: Build and Upload to Buildbot
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install vpatch
run: dotnet tool install --global Nefarius.Tools.Vpatch
- name: Stamp version in resource file
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$semverPattern = '^v?(\d+)\.(\d+)\.(\d+)(?:-(.+))?$'
if ($tag -notmatch $semverPattern) {
Write-Error "Tag '$tag' does not match semantic version pattern (e.g. v1.2.3 or v1.2.3-rc1). Expected: ^v?(\d+)\.(\d+)\.(\d+)(?:-(.+))?$"
exit 1
}
$major = $Matches[1]
$minor = $Matches[2]
$patch = $Matches[3]
$versionNumeric = "$major.$minor.$patch.0"
vpatch --stamp-version $versionNumeric --target-file "res\app.rc" --resource.file-version --resource.product-version
- name: Bootstrap vcpkg
run: vcpkg/bootstrap-vcpkg.bat
- name: Configure
run: cmake --preset default
- name: Build Release
run: cmake --build --preset release
- name: Upload artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: build/Release/**
- name: Send webhook
shell: bash
run: |
artifact_name="${{ github.event.repository.name }}"
artifact_id="${{ steps.upload.outputs.artifact-id }}"
artifact_url="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${artifact_id}/zip"
payload=$(jq -n \
--arg fileName "${artifact_name}.zip" \
--arg url "$artifact_url" \
--arg projectName "${{ github.event.repository.name }}" \
--arg branch "${{ github.ref_name }}" \
--arg buildVersion "${{ github.ref_name }}" \
'{
artifacts: [
{
fileName: $fileName,
url: $url
}
],
environmentVariables: {
appveyor_project_name: $projectName,
appveyor_repo_branch: $branch,
appveyor_build_version: $buildVersion
}
}')
curl -X POST "${{ secrets.WEBHOOK_URL }}" \
-H "Content-Type: application/json" \
-H "X-GitHub-Token: ${{ secrets.GITHUB_TOKEN }}" \
-d "$payload"