-
-
Notifications
You must be signed in to change notification settings - Fork 12
130 lines (108 loc) · 4.08 KB
/
build.yaml
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
130
name: Publish Nightly Release on Commit
on:
push:
branches:
- main # Trigger on pushes to main branch
jobs:
# Windows Build Job
windows-build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up .NET for Windows
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x' # Specify your .NET version
# Step 3: Restore dependencies
- name: Restore dependencies
run: dotnet restore
# Step 4: Publish the project as a single file for Windows 64-bit
- name: Publish the application (Windows)
run: dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./publish
# Step 5: Zip the Windows publish folder
- name: Zip the Windows publish folder
run: zip -r ./publish/win64.zip ./publish
# Step 6: Upload the Windows build as an artifact to be used in release
- name: Upload Windows Build Artifact
uses: actions/upload-artifact@v3
with:
name: win64
path: ./publish/win64.zip
# Linux Build Job
linux-build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up .NET for Linux
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x' # Specify your .NET version
# Step 3: Restore dependencies
- name: Restore dependencies
run: dotnet restore
# Step 4: Publish the project as a single file for Linux 64-bit
- name: Publish the application (Linux)
run: dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true -o ./publish
# Step 5: Copy the native library
- name: Copy libsteam_api.so to publish folder
run: cp ./NativeLibraries/linux64/libsteam_api.so ./publish/
# Step 6: Zip the Linux publish folder
- name: Zip the Linux publish folder
run: zip -r ./publish/linux64.zip ./publish
# Step 7: Upload the Linux build as an artifact to be used in release
- name: Upload Linux Build Artifact
uses: actions/upload-artifact@v3
with:
name: linux64
path: ./publish/linux64.zip
# Create Release Job
create-release:
runs-on: ubuntu-latest
needs: [windows-build, linux-build] # Waits for both builds to finish
steps:
# Step 1: Download artifacts from previous jobs
- name: Download Windows Artifact
uses: actions/download-artifact@v3
with:
name: win64
- name: Download Linux Artifact
uses: actions/download-artifact@v3
with:
name: linux64
# Step 2: Create a new nightly release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "nightly-${{ github.run_number }}" # Static tag name for nightly builds
release_name: "nightly-${{ github.run_number }}" # Unique name for each run
draft: false
prerelease: true # Mark as prerelease if you want to differentiate
# Step 3: Upload Windows artifact to release
- name: Upload Windows Build to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: win64.zip
asset_name: win64.zip
asset_content_type: application/zip
# Step 4: Upload Linux artifact to release
- name: Upload Linux Build to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: linux64.zip
asset_name: linux64.zip
asset_content_type: application/zip