-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 3.08 KB
/
workflow.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
name: Publish Release
on:
workflow_dispatch:
inputs:
version:
type: string
description: Version number
required: true
jobs:
build:
runs-on: ubuntu-latest
env:
BundleBepInEx : false
BepInExVersion : 5
BepInExArch : x64
BepInExRuntime : IL2CPP
PluginName : PhantomGamers-DSPAchievementsEnabler
GithubRelease : true
ThunderstoreRelease: true
steps:
- name: Check Tag
id: check-tag
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.event.inputs.version }}
regex: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
- name: Fail if invalid
if: steps.check-tag.outputs.match == ''
uses: Actions/github-script@v3
with:
script: |
core.setFailed('Invalid tag')
- name: Determine OutDir (BepInEx)
if: env.BundleBepInEx == 'true'
run: |
echo "OutDir=out/BepInEx/plugins/${{env.PluginName}}" >> $GITHUB_ENV
- name: Determine OutDir
if: env.BundleBepInEx == 'false'
run: |
echo "OutDir=out/${{env.PluginName}}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- name: BepInEx 6
run: |
bepinexurl = $(curl -vs https://builds.bepinex.dev/projects/bepinex_be 2>&1 | grep -Po '(?<=href=")(\/projects\/bepinex_be\/(.*)\/BepInEx_Unity${{env.BepInExRuntime}}_${{env.BepInExArch}}(.*))(?=")' | head -1)"
wget $bepinexurl > bepinex.zip
if: env.BundleBepInEx == 'true' && env.BepInExVersion == '6'
- name: BepInEx 5
shell: pwsh
run: |
$webData = Invoke-WebRequest -Uri "https://api.github.com/repos/BepInEx/BepInEx/releases/latest"
$release = ConvertFrom-Json $webData.content
$bepinexurl = $release.assets.browser_download_url -match '${{env.BepInExArch}}'
wget $bepinexurl > bepinex.zip
if: env.BundleBepInEx == 'true' && env.BepInExVersion == '5'
- name: Extract BepInEx
run: |
mkdir out;
unzip BepInEx* -d out;
if: env.BundleBepInEx == 'true'
- name: Build & zip
run: |
dotnet build -c Release /p:Version=${{ github.event.inputs.version }} -o ${{env.OutDir}}
cd out && zip -r ../${{env.PluginName}}-${{env.BepInExArch}}.zip * && cd ..
mkdir dist
cp -r ${{env.OutDir}}/* dist
- name: Publish to Github
uses: ncipollo/release-action@v1
with:
artifacts: "${{env.PluginName}}-${{env.BepInExArch}}.zip"
tag: ${{ github.event.inputs.version }}
commit: ${{ github.ref }}
artifactErrorsFailBuild: true
draft: true
allowUpdates: true
if: env.GithubRelease == 'true'
- name: Publish to Thunderstore
env:
TCLI_AUTH_TOKEN: ${{ secrets.TCLI_AUTH_TOKEN }}
run: |
dotnet tool install -g tcli
tcli publish --package-version ${{ github.event.inputs.version }}
if: env.ThunderstoreRelease == 'true'