Skip to content

Commit f5d5dc0

Browse files
committed
Tạo MSBuild pipeline
Tạo build pipeline sử dụng tính năng Artifact Attestation của GitHub Actions, đảm bảo file chạy OpenKey được tạo từ GitHub Actions và tương ứng với mã nguồn. Signed-off-by: Tu Dinh <[email protected]>
1 parent a05ef6e commit f5d5dc0

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/msbuild.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: MSBuild
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
# Path to the solution file relative to the root of the project.
11+
SOLUTION_FILE_PATH: .\Sources\OpenKey\win32\OpenKey
12+
13+
# Configuration type to build.
14+
# You can convert this to a build matrix if you need coverage of multiple configuration types.
15+
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
16+
BUILD_CONFIGURATION: Release
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
build:
23+
runs-on: windows-latest
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Add MSBuild to PATH
29+
uses: microsoft/setup-msbuild@v2
30+
31+
- name: Build x86
32+
run: msbuild -m -target:Rebuild -p:Configuration=Release -p:Platform=x86 ${{env.SOLUTION_FILE_PATH}}
33+
34+
- name: Build x64
35+
run: msbuild -m -target:Rebuild -p:Configuration=Release -p:Platform=x64 ${{env.SOLUTION_FILE_PATH}}
36+
37+
- name: Upload a Build Artifact
38+
id: upload
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: OpenKey
42+
path: |
43+
${{env.SOLUTION_FILE_PATH}}/Release/
44+
${{env.SOLUTION_FILE_PATH}}/x64/Release/
45+
46+
outputs:
47+
subject-name: OpenKey
48+
subject-digest: ${{steps.upload.outputs.artifact-digest}}
49+
50+
attest:
51+
runs-on: ubuntu-latest
52+
needs: build
53+
54+
permissions:
55+
id-token: write
56+
contents: read
57+
attestations: write
58+
59+
steps:
60+
- name: Generate artifact attestation
61+
uses: actions/attest-build-provenance@v2
62+
with:
63+
subject-name: ${{needs.build.outputs.subject-name}}
64+
subject-digest: sha256:${{needs.build.outputs.subject-digest}}

0 commit comments

Comments
 (0)