generated from szapp/patch-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 3.52 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: build
on:
push:
tags:
- "[Vv]?[0-9]+.[0-9]+*"
release:
types: [published]
workflow_dispatch:
# To auto-deploy to the Steam workshop on new tag/release
# (1) the secrets 'STEAM_USERNAME' and 'STEAM_CONFIG_VDF'
# need to exist in the repository, following these instructions:
# https://github.com/m00nl1ght-dev/steam-workshop-deploy#configvdf
# (2) the patch must already exist on the Steam workshop
# (3) the workshop item IDs must be added below (one or both)
# Leaving the variables empty, will skip the deployment steps
env:
STEAM_WORKSHOP_G1:
STEAM_WORKSHOP_G2: 2787341517
permissions:
contents: write
jobs:
vdfsbuilder:
name: Create VDF
runs-on: ubuntu-latest
steps:
- name: Get patch name from repository name
run: |
echo "PATCH_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Get short SHA
if: (!startsWith(github.ref, 'refs/tags/'))
run: echo "VERSION=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Build VDF
uses: kirides/vdfsbuilder@aaf901f0c98245af54102a1946d8be0e2e17ba36
with:
in: ${{ env.PATCH_NAME }}.vm
- name: Create release with assets (if tag pushed)
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'release'
run: gh release create ${{ env.VERSION }} --generate-notes "${{ env.PATCH_NAME }}.vdf" || exit 0
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Upload release assets (if release published)
if: github.event_name == 'release'
run: gh release upload ${{ env.VERSION }} "${{ env.PATCH_NAME }}.vdf" || exit 0
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Prepare Steam workshop upload
if: (startsWith(github.ref, 'refs/tags/') || github.event_name == 'release') && (env.STEAM_WORKSHOP_G1 != '' || env.STEAM_WORKSHOP_G2 != '')
run: |
mkdir -p content/Data
cp *.vdf content/Data/
- name: Update in Gothic 1 Steam workshop
if: (startsWith(github.ref, 'refs/tags/') || github.event_name == 'release') && env.STEAM_WORKSHOP_G1 != ''
uses: m00nl1ght-dev/steam-workshop-deploy@v2
with:
username: ${{ secrets.STEAM_USERNAME }}
configVdf: ${{ secrets.STEAM_CONFIG_VDF }}
path: content
appId: 65540
publishedFileId: ${{ env.STEAM_WORKSHOP_G1 }}
changeNote: |
Version ${{ env.VERSION }}
Release notes: https://github.com/${{ github.repository }}/releases/tag/${{ env.VERSION }}
- name: Update in Gothic 2 Steam workshop
if: (startsWith(github.ref, 'refs/tags/') || github.event_name == 'release') && env.STEAM_WORKSHOP_G2 != ''
uses: m00nl1ght-dev/steam-workshop-deploy@v2
with:
username: ${{ secrets.STEAM_USERNAME }}
configVdf: ${{ secrets.STEAM_CONFIG_VDF }}
path: content
appId: 39510
publishedFileId: ${{ env.STEAM_WORKSHOP_G2 }}
changeNote: |
Version ${{ env.VERSION }}
Release notes: https://github.com/${{ github.repository }}/releases/tag/${{ env.VERSION }}
- name: Upload artifacts
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PATCH_NAME }}-${{ env.VERSION }}
path: "${{ env.PATCH_NAME }}.vdf"
overwrite: true