-
Notifications
You must be signed in to change notification settings - Fork 7
75 lines (68 loc) · 2.61 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
name: Build project
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
prepareBuild:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
steps:
- name: Create Release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release v${{ github.ref }}
draft: false
prerelease: true
buildForAllSupportedPlatforms:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
needs: prepareBuild
strategy:
fail-fast: false
matrix:
projectPath:
- Blocktest
- DedicatedServer
targetPlatform:
- linux-x64 # Build a macOS standalone (Intel 64-bit).
- win-x86 # Build a Windows 32-bit standalone.
- win-x64 # Build a Windows 64-bit standalone.
- osx-x64 # Build a Linux 64-bit standalone.
dotnet:
- '7.x'
- '6.x'
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
${{ matrix.dotnet }}
3.1.x
- name: Build
run: dotnet publish ${{ matrix.projectPath }} --configuration Release --runtime ${{ matrix.targetPlatform }} -p:PublishReadyToRun=false -p:TieredCompilation=false -p:PublishSingleFile=true -p:Version=$(git describe --tags --abbrev=0) --self-contained false --output ./Build/${{ matrix.targetPlatform }}
- name: Zip build
run: |
pushd Build/${{ matrix.targetPlatform }}
zip -r ../../Blocktest-${{ matrix.targetPlatform }}-${{ matrix.dotnet }}.zip .
popd
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1 #TODO: Update to a maintained action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepareBuild.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Blocktest-${{ matrix.targetPlatform }}-${{ matrix.dotnet }}.zip
asset_name: ${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ matrix.dotnet }}.zip
asset_content_type: application/zip