-
Notifications
You must be signed in to change notification settings - Fork 16
154 lines (126 loc) · 6.06 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
146
147
148
149
150
151
152
153
154
name: CI
on: [push]
jobs:
build_linux:
runs-on: ubuntu-22.04
outputs:
release_name: ${{ steps.get-version.outputs.release_name }}
steps:
- uses: actions/checkout@master
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- run: dotnet --list-runtimes && dotnet --list-sdks
name: Output dotnet versions for debugging
- run: git submodule update --init
name: Ensure submodules are present and up to date
- run: mkdir -p /tmp/zips
name: Create output directory
- run: dotnet publish -c Release -o /tmp/out-linux/replanetizer --self-contained --runtime linux-x64 Replanetizer
name: Build Replanetizer for Linux
- run: echo ::set-output name=release_name::$(grep -m 1 'InformationalVersionAttribute' Replanetizer/obj/Release/*/*/Replanetizer.AssemblyInfo.cs | cut -d '"' -f 2)
id: get-version
name: Get Informational Version Attribute
- run: cd /tmp/out-linux/ && zip -r /tmp/zips/replanetizer-${{steps.get-version.outputs.release_name}}-linux-x64.zip replanetizer
name: Zip up Replanetizer for Linux
- uses: actions/upload-artifact@v2
name: Upload zips to GitHub actions artifact storage
with:
name: replanetizer-${{steps.get-version.outputs.release_name}}-linux-x64.zip
path: /tmp/zips/replanetizer-${{steps.get-version.outputs.release_name}}-linux-x64.zip
build_windows:
runs-on: windows-2022
needs: [build_linux]
steps:
- uses: actions/checkout@master
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- run: dotnet --list-runtimes && dotnet --list-sdks
name: Output dotnet versions for debugging
- run: git submodule update --init
name: Ensure submodules are present and up to date
- run: mkdir -p /tmp/zips
name: Create output directory
- run: dotnet publish -c Release -o /tmp/out-win/replanetizer --self-contained --runtime win-x64 Replanetizer
name: Build Replanetizer for Windows
- run: Compress-Archive -Path /tmp/out-win/replanetizer -DestinationPath /tmp/zips/replanetizer-${{needs.build_linux.outputs.release_name}}-win-x64.zip
name: Zip up Replanetizer for Windows
- uses: actions/upload-artifact@v2
name: Upload zips to GitHub actions artifact storage
with:
name: replanetizer-${{needs.build_linux.outputs.release_name}}-win-x64.zip
path: /tmp/zips/replanetizer-${{needs.build_linux.outputs.release_name}}-win-x64.zip
build_macos:
runs-on: macos-12
needs: [build_linux]
steps:
- uses: actions/checkout@master
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- run: dotnet --list-runtimes && dotnet --list-sdks
name: Output dotnet versions for debugging
- run: git submodule update --init
name: Ensure submodules are present and up to date
- run: mkdir -p /tmp/zips
name: Create output directory
- run: dotnet publish -c Release -o /tmp/out-osx/replanetizer --self-contained --runtime osx-x64 Replanetizer
name: Build Replanetizer for Mac
- run: cd /tmp/out-osx/ && zip -r /tmp/zips/replanetizer-${{needs.build_linux.outputs.release_name}}-osx-x64.zip replanetizer
name: Zip up Replanetizer for Mac
- uses: actions/upload-artifact@v2
name: Upload zips to GitHub actions artifact storage
with:
name: replanetizer-${{needs.build_linux.outputs.release_name}}-osx-x64.zip
path: /tmp/zips/replanetizer-${{needs.build_linux.outputs.release_name}}-osx-x64.zip
release:
runs-on: ubuntu-20.04
needs: [build_linux, build_windows, build_macos]
if: github.ref == 'refs/heads/master'
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
with:
path: ./
- name: Create Release
id: create_release
if: github.ref == 'refs/heads/master'
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{needs.build_linux.outputs.release_name}}
release_name: v${{needs.build_linux.outputs.release_name}}
draft: false
prerelease: false
- name: Upload Release Asset Linux
if: github.ref == 'refs/heads/master'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: replanetizer-${{needs.build_linux.outputs.release_name}}-linux-x64.zip
asset_path: replanetizer-${{needs.build_linux.outputs.release_name}}-linux-x64.zip/replanetizer-${{needs.build_linux.outputs.release_name}}-linux-x64.zip
asset_content_type: application/zip
- name: Upload Release Asset Windows
if: github.ref == 'refs/heads/master'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: replanetizer-${{needs.build_linux.outputs.release_name}}-win-x64.zip
asset_path: replanetizer-${{needs.build_linux.outputs.release_name}}-win-x64.zip/replanetizer-${{needs.build_linux.outputs.release_name}}-win-x64.zip
asset_content_type: application/zip
- name: Upload Release Asset macOS
if: github.ref == 'refs/heads/master'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: replanetizer-${{needs.build_linux.outputs.release_name}}-osx-x64.zip
asset_path: replanetizer-${{needs.build_linux.outputs.release_name}}-osx-x64.zip/replanetizer-${{needs.build_linux.outputs.release_name}}-osx-x64.zip
asset_content_type: application/zip