-
Notifications
You must be signed in to change notification settings - Fork 5
85 lines (80 loc) · 2.74 KB
/
githubactionsbuilds.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
name: GitHubActionsBuilds
on:
workflow_dispatch:
inputs:
version:
description: 'The version (e.g. 5.5.0)'
required: false
releaseNotes:
description: 'The release notes'
required: false
push:
branches: [ development ]
pull_request:
branches: [ development ]
jobs:
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core @ Latest
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Determine Version
run: |
$version = '${{github.event.inputs.version}}'
if ([string]::IsNullOrEmpty($version)) {
$version = '1.0.0'
}
echo "::set-output name=version::$version"
id: determine-version
- name: Run SetupBuildEnv.ps1 script
run: .\Scripts\SetupBuildEnv.ps1
shell: powershell
- name: Run SetupBuildEnv.ps1 script
run: .\Scripts\VersionBepInPlugins.ps1 -desiredVersion "${{ steps.determine-version.outputs.version }}.0"
shell: powershell
- name: Run build
run: |
dotnet build Loki-Valheim-ClientMods.sln -c Release -o "Build/ModsBuildOutput" /p:Version=${{ steps.determine-version.outputs.version }}
if (!(Test-Path "Build/ModsOutput" -PathType Container)) {
New-Item "Build/ModsOutput" -ItemType "directory"
}
Copy-Item "Build/ModsBuildOutput/*ValheimClientMod.dll" "Build/ModsOutput"
7z a -mm=Deflate -mfb=258 -mpass=15 "Build/ModsOutput/ClientMods.zip" "Build/ModsOutput/*.dll" '-x!*.pdb'
- name: Upload WebApp1 Build Artifact
uses: actions/upload-artifact@v2
with:
name: ModsOutput
path: Build/ModsOutput
create_release:
runs-on: windows-latest
needs: build_windows
if: github.event.inputs.version != '' && github.event.inputs.releaseNotes != ''
steps:
- uses: actions/download-artifact@v2
with:
name: ModsOutput
path: Build/ModsOutput
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{github.event.inputs.version}}
release_name: ${{github.event.inputs.version}}
body: |
${{ github.event.inputs.releaseNotes }}
draft: false
prerelease: false
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{github.event.inputs.version}}
files: |
./Build/ModsOutput/*.dll
./Build/ModsOutput/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}