-
Notifications
You must be signed in to change notification settings - Fork 6
145 lines (121 loc) · 3.8 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Build and test
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
packages: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: 2.2.108
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Restore packages
run: dotnet restore
- name: Build
run: dotnet build
- name: Test
run: dotnet test
- name: Pack for version
if: startsWith(github.ref, 'refs/tags/v')
run: dotnet pack -c Release -p:PackageVersion=${GITHUB_REF:11}
- name: Pack without version
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: dotnet pack -c Release -p:PackageVersion=1.0.0.0
- name: Upload windows artifact
uses: actions/upload-artifact@v3
with:
name: nuget
path: ./BrainAI/bin/Release/BrainAI.*.nupkg
godot:
needs: build
runs-on: ubuntu-latest
name: Build artifacts
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: 2.2.108
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Restore packages
run: |
dotnet restore "./BrainAI.Demo/BrainAI Demo.sln"
- name: Export game
id: export
uses: firebelley/godot-export@v4.4.0
with:
godot_executable_download_url: https://downloads.tuxfamily.org/godotengine/3.5.1/mono/Godot_v3.5.1-stable_mono_linux_headless_64.zip
godot_export_templates_download_url: https://downloads.tuxfamily.org/godotengine/3.5.1/mono/Godot_v3.5.1-stable_mono_export_templates.tpz
relative_project_path: ./BrainAI.Demo/
export_debug: false
use_preset_export_path: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ steps.export.outputs.build_directory }}/HTML5
deploy_html5:
needs: godot
name: Deploy to github pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
pack:
needs: build
name: deploy
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: nuget
path: ./artifacts
- name: Setup nuget
uses: nuget/setup-nuget@v1
with:
nuget-version: 'latest'
- name: Setup nuget config
run: nuget.exe sources add -name github -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" -username ${{ github.actor }} -password ${{ secrets.GITHUB_TOKEN }}
- name: Upload to GitHub Packages
run: |
for f in ./artifacts/*.nupkg
do
nuget push $f -Source "github"
done
shell: bash