-
Notifications
You must be signed in to change notification settings - Fork 4
113 lines (93 loc) · 2.77 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
name: Build and Release
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Tag the repository
id: tag
run: |
git config user.name "GitHub Action"
git config user.email "[email protected]"
# See https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names
TAG=$(echo ${GITHUB_SHA} | cut -c1-8)
echo "$TAG"
echo "tag=$TAG" >> $GITHUB_OUTPUT
git tag -a $TAG -m "Automated build on push: $TAG" ${GITHUB_SHA}
git push origin $TAG
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
- name: Restore dependencies
run: dotnet restore Loader
- name: Build
run: dotnet build --configuration Release Loader
- name: Publish Release
run: |
dotnet publish -c Release -o publish Loader
mkdir -p release
cp -r publish/* release/
shell: bash
- uses: actions/upload-artifact@v3
with:
name: linux-build
path: release/*
if-no-files-found: error
build-windows:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
- name: Restore dependencies
run: dotnet restore Loader
- name: Build
run: dotnet build --configuration Release Loader
- name: Publish Release
run: |
dotnet publish -c Release -o publish Loader
mkdir -p release
cp -r publish/* release/
shell: bash
- uses: actions/upload-artifact@v3
with:
name: windows-build
path: release/*
if-no-files-found: error
release:
needs: [ build, build-windows ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
id: download-linux
with:
name: linux-build
path: linux-release
- uses: actions/download-artifact@v3
id: download-windows
with:
name: windows-build
path: windows-release
- name: Create Release and Upload Asset
uses: softprops/action-gh-release@v1
with:
files: |
linux-release/Loader
windows-release/Loader.exe
tag_name: ${{ needs.build.outputs.tag }}
draft: false
prerelease: true
body: "Automated build on push"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}