Skip to content

Commit 1b4564d

Browse files
authored
ci(actions): add build script for GitHub Actions (#2)
* build(actions): add GitHub Actions build configuration * build(actions): fix failing to build * build(actions): fix failing to build * build(actions): fix failing to build * build(actions): add PDB file building * Update build.yml * Update build.yml
1 parent 6836e02 commit 1b4564d

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/build.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types:
8+
- released
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: windows-latest
15+
steps:
16+
- name: Get version if release
17+
if: github.event_name == 'release'
18+
run: echo "VERSION=${{ github.ref_name }}" | sed 's/=v/=/' >> $env:GITHUB_ENV
19+
20+
- name: Set default version if not release
21+
if: github.event_name != 'release'
22+
run: echo "VERSION=0.0.0" >> $env:GITHUB_ENV
23+
24+
- name: Checkout the repository
25+
uses: actions/checkout@v3
26+
with:
27+
submodules: true
28+
29+
- name: Build PreLoader
30+
run: |
31+
mkdir -p build
32+
cd build
33+
cmake ..
34+
cmake --build . --config Release -j
35+
36+
- name: Upload build
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: preloader-${{ env.VERSION }}-windows-amd64
40+
path: build/Release/PreLoader.dll
41+
42+
- name: Upload PDB file
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: preloader-${{ env.VERSION }}-windows-amd64-pdb
46+
path: build/Release/PreLoader.pdb
47+
48+
upload-to-release:
49+
name: Upload to release
50+
needs:
51+
- build
52+
runs-on: ubuntu-latest
53+
if: github.event_name == 'release'
54+
steps:
55+
- name: Get version
56+
run: echo "VERSION=${{ github.ref_name }}" | sed 's/=v/=/' >> $GITHUB_ENV
57+
58+
- name: Download artifacts
59+
uses: actions/download-artifact@v3
60+
61+
- name: Upload release assets
62+
uses: softprops/action-gh-release@v1
63+
with:
64+
files: |
65+
preloader-${{ env.VERSION }}-windows-amd64/PreLoader.dll
66+
preloader-${{ env.VERSION }}-windows-amd64-pdb/PreLoader.pdb

0 commit comments

Comments
 (0)