-
Notifications
You must be signed in to change notification settings - Fork 12
212 lines (175 loc) · 7.78 KB
/
Copy pathmain.yml
File metadata and controls
212 lines (175 loc) · 7.78 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Publish
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
outputs:
release_url: ${{steps.share_release_url.outputs.url}}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-dotnet@v1
- name: Install mono and xbuild
run: |
sudo apt-get update
sudo apt-get install -y git mono-complete mono-xbuild nuget
- name: Install NexusUploader
run: dotnet tool install -g NexusUploader
- name: Get the Release version tag and mod name
id: vars
run: |
echo ::set-output name=tag::$(echo ${GITHUB_REF:11} | cut -d'-' -f 1 | cat)
echo ::set-output name=mod::$(echo ${GITHUB_REF:11} | cut -d'-' -f 2 | cat)
- name: Update const string BepinEx version field
run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' ${{steps.vars.outputs.mod}}/${{steps.vars.outputs.mod}}.cs
- name: Check file existence
id: check_files
run: echo ::set-output name=exists::$((test -f ${{steps.vars.outputs.mod}}/manifest.json && echo true) || echo false)
- name: Update manifest/json version field
run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' ${{steps.vars.outputs.mod}}/manifest.json
if: steps.check_files.outputs.exists == 'true'
- name: Build and Create the package
run: xbuild ValheimMod.sln /t:${{steps.vars.outputs.mod}} /p:Configuration=Release /p:Version=${{steps.vars.outputs.tag}} /p:OutputPath=..
# Package for Thunderstore
- uses: papeloto/action-zip@v1
with:
files: ${{steps.vars.outputs.mod}}.dll ${{steps.vars.outputs.mod}}/icon.png ${{steps.vars.outputs.mod}}/manifest.json ${{steps.vars.outputs.mod}}/README.md
dest: ${{steps.vars.outputs.mod}}.zip
if: steps.check_files.outputs.exists == 'true'
# Package for Nexus Mods
- uses: papeloto/action-zip@v1
with:
files: ${{steps.vars.outputs.mod}}.dll
dest: ${{steps.vars.outputs.mod}}_nexusmods.zip
- name: Change Log
id: changelog
run: |
git fetch --tags --force # Retrieve annotated tags. THIS TRICK REALLY HELPS
echo 'CHANGELOG<<EOF' >> $GITHUB_ENV
git tag -l ${GITHUB_REF:10} --format='%(contents:body)' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- 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:
body: |
Change Log
${{ env.CHANGELOG }}
tag_name: ${{ github.ref }}
release_name: Release ${{steps.vars.outputs.mod}} ${{steps.vars.outputs.tag}}
draft: false
prerelease: false
- name: Share release url
id: share_release_url
run: echo "::set-output name=url::${{ steps.create_release.outputs.upload_url }}"
- name: Upload Release Asset
id: upload-thunderstore-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{steps.vars.outputs.mod}}.zip
asset_name: ${{steps.vars.outputs.mod}}_thunderstore.zip
asset_content_type: application/zip
if: steps.check_files.outputs.exists == 'true'
- name: Upload Release Asset
id: upload-nexusmod-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{steps.vars.outputs.mod}}_nexusmods.zip
asset_name: ${{steps.vars.outputs.mod}}_nexusmods.zip
asset_content_type: application/zip
#- name: Upload
# run: |
# unex upload 504 ValheimLib_release.zip -v ${{ steps.vars.outputs.tag }}
# env:
# UNEX_APIKEY: ${{ secrets.NEXUS_API_KEY }}
# UNEX_COOKIES: ${{ secrets.NEXUS_COOKIES }}
# UNEX_DEBUG: true
# UNEX_FILENAME: ValheimLib
# UNEX_GAME: valheim
variants:
if: endsWith(github.ref, 'EquipWheel')
strategy:
matrix:
mod: [EquipWheelTwo, EquipWheelThree, EquipWheelFour]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v1
- name: Install mono and xbuild
run: |
sudo apt-get update
sudo apt-get install -y git mono-complete mono-xbuild nuget
- name: Get the Release version tag and mod name
id: vars
run: |
echo ::set-output name=tag::$(echo ${GITHUB_REF:11} | cut -d'-' -f 1 | cat)
echo ::set-output name=mod::$(echo ${GITHUB_REF:11} | cut -d'-' -f 2 | cat)
- name: Update const string BepinEx version field
run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' EquipWheel/EquipWheel.cs
- name: Build and Create the package
run: xbuild ValheimMod.sln /t:${{matrix.mod}} /p:Configuration=Release /p:Version=${{steps.vars.outputs.tag}} /p:OutputPath=..
- uses: actions/upload-artifact@v3
with:
name: more-equipwheels
path: ${{matrix.mod}}.dll
bundle-variants:
if: endsWith(github.ref, 'EquipWheel')
runs-on: ubuntu-latest
needs:
- publish
- variants
steps:
- uses: actions/checkout@v3
- name: Get the Release version tag and mod name
id: vars
run: |
echo ::set-output name=tag::$(echo ${GITHUB_REF:11} | cut -d'-' -f 1 | cat)
echo ::set-output name=mod::$(echo ${GITHUB_REF:11} | cut -d'-' -f 2 | cat)
- name: Update const string version field (1/2)
run: sed -i 's/"0.0.1"/"${{steps.vars.outputs.tag}}"/g' MoreEquipWheels/manifest.json
- name: Update const string version field (2/2)
run: sed -i 's/"virtuaCode-EquipWheel-0.0.1"/"virtuaCode-EquipWheel-${{steps.vars.outputs.tag}}"/g' MoreEquipWheels/manifest.json
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: more-equipwheels
- uses: papeloto/action-zip@v1
with:
files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll MoreEquipWheels/icon.png MoreEquipWheels/manifest.json MoreEquipWheels/README.md
dest: More_EquipWheels_thunderstore.zip
- uses: papeloto/action-zip@v1
with:
files: EquipWheelTwo.dll EquipWheelThree.dll EquipWheelFour.dll
dest: More_EquipWheels_nexusmods.zip
- name: Upload Release Asset
id: upload-nexusmod-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish.outputs.release_url }}
asset_path: ./More_EquipWheels_nexusmods.zip
asset_name: More_EquipWheels_nexusmods.zip
asset_content_type: application/zip
- name: Upload Release Asset
id: upload-thunderstore-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish.outputs.release_url }}
asset_path: ./More_EquipWheels_thunderstore.zip
asset_name: More_EquipWheels_thunderstore.zip
asset_content_type: application/zip