-
-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (65 loc) · 2.53 KB
/
deploy.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
name: Publish package
on:
release:
types: [published] # run when a new release is published
tags:
- 'v*' # Trigger only if the tag matches eg. v1.0.0
workflow_run:
workflows: ["build"] # run if build.yml is successfully completed
types:
- completed
env:
name: ChebsNecromancy
jsonf: manifest.json
dlpath: https://github.com/jpw1991/chebs-necromancy/releases/download
dependencies: "ValheimModding-Jotunn@2.16.2" # dependencies separated by spaces
categories: "Mods" # categories separated by spaces
namespace: ChebGonaz
jobs:
verify-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check tag
run: |
# the tags check above doesn't seem to work properly, so a more rigorous check here
if [ "${{ github.event_name }}" == "release" ]; then
echo "This workflow was triggered by a release."
release_tag="${{ github.event.release.tag_name }}"
# Check if the tag matches semantic versioning pattern
if ! [[ $release_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+)?$ ]]; then
echo "Error: Release tag ($release_tag) does not match semantic versioning pattern."
exit 1
fi
exit 0
elif [ "${{ github.event_name }}" == "workflow_run" ]; then
echo "This workflow was triggered by a workflow run."
exit 0
else
echo "This workflow was triggered by an unknown event: ${{ github.event_name }}"
exit 1
fi
publish:
needs: verify-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Read manifest
run: |
version="$(jq -r '.version_number' ${{env.name}}/Package/${{env.jsonf}})"
description="$(jq -r '.description' ${{env.name}}/Package/${{env.jsonf}})"
echo "VERSION=${version}" >> $GITHUB_ENV
echo "DESCRIPTION=${description}" >> $GITHUB_ENV
- run: wget ${{env.dlpath}}/v${{env.VERSION}}/${{env.name}}.${{env.VERSION}}.zip
- name: Upload Thunderstore Package
uses: GreenTF/upload-thunderstore-package@v4
with:
community: valheim
namespace: ${{env.namespace}}
name: ${{env.name}}
version: ${{env.VERSION}}
description: ${{env.DESCRIPTION}}
token: ${{secrets.TS_KEY}}
deps: ${{env.dependencies}}
categories: ${{env.categories}}
file: ${{env.name}}.${{env.VERSION}}.zip