-
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (151 loc) · 5.33 KB
/
release.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
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
name: Create release + SMP + package
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag: (X.X.X)'
required: true
type: string
title:
description: 'Release title:'
required: false
type: string
jobs:
# Check signing key
check-key:
name: 'Check key'
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.key-check.outputs.exists }}
steps:
- name: Check for signing key availability
id: key-check
shell: bash
run: |
if [ "${{ secrets.GPG_PRIVATE_KEY }}" != '' ]; then
echo "exists=true" >> $GITHUB_OUTPUT;
else
echo "exists=false" >> $GITHUB_OUTPUT;
fi
- name: Result
run: echo "Key found:" ${{ steps.key-check.outputs.exists }}
# Bump version
update-version:
needs: [check-key]
name: 'Bump version'
runs-on: ubuntu-latest
outputs:
commit_hash: ${{ steps.commit-and-push.outputs.commit_hash }}
steps:
- uses: actions/[email protected]
- name: Write version to file
uses: "DamianReeves/write-file-action@master"
with:
path: VERSION
write-mode: overwrite
contents: v${{ inputs.tag }}
- name: Import GPG key
if: ${{ needs.check-key.outputs.exists == 'true' }}
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit & Push
id: commit-and-push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Bump version by ${{ github.workflow}}
commit_user_email: ${{ github.actor }}@users.noreply.github.com
commit_user_name: ${{ github.actor }}
# Create new release + Tag
release:
needs: [update-version,check-key]
name: 'Create release'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
ref: ${{ needs.update-version.outputs.commit_hash }}
- name: Import GPG key
if: ${{ needs.check-key.outputs.exists == 'true' }}
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Bump version and push tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN}}
custom_tag: ${{ inputs.tag }}
tag_prefix: 'v'
commit_sha: ${{ needs.update-version.outputs.commit_hash }}
- name: 'Create readme header'
shell: bash
working-directory: '.'
run: |
cp .github/RELEASE_HEAD.md RELEASE_HEAD.md
- name: 'Create release notes'
uses: CSchoel/[email protected]
with:
version: ${{ inputs.tag }}
- name: 'Create Release using GitHub CLI'
env:
# Expires every year, use bot as fallback
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
run: >
gh release create
--verify-tag
--latest
-F RELEASE.md
-t 'v${{ inputs.tag }} - ${{ inputs.title }}'
'v${{ inputs.tag }}'
# Attach assets
mod:
needs: release
name: 'Attach SMP mod'
runs-on: ubuntu-latest
steps:
- name: 'Get binaries'
run: |
curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
-H 'Accept: application/vnd.github.v4.raw' \
-O \
-L https://api.github.com/repos/regorxxx/foobar2000-assets/contents/Spider%20Monkey%20Panel/foo_spider_monkey_panel-v1.6.1-mod.fb2k-component
- uses: AButler/[email protected]
with:
files: 'foo_spider_monkey_panel-v1.6.1-mod.fb2k-component'
repo-token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
release-tag: 'v${{ inputs.tag }}'
# Build and attach package
package:
needs: release
name: 'Attach Package'
runs-on: windows-latest
steps:
- uses: thaitype/actions-switch-case@v1
id: switch-case
with:
default: '0'
conditionals-with-values: |
${{ 'World-Map-SMP' == github.event.repository.name }} => '1'
${{ 'Playlist-Manager-SMP' == github.event.repository.name }} => '2'
${{ 'Not-a-Waveform-Seekbar-SMP' == github.event.repository.name }} => '3'
${{ 'Timeline-SMP' == github.event.repository.name }} => '4'
- uses: actions/[email protected]
if: ${{ steps.switch-case.outputs.match != '0' }}
- name: 'Create package'
if: ${{ steps.switch-case.outputs.match != '0'}}
run: ./_createPackage.bat ${{ steps.switch-case.outputs.match }}
- uses: AButler/[email protected]
if: ${{ steps.switch-case.outputs.match != '0' }}
with:
files: 'packages/*.zip'
repo-token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
release-tag: 'v${{ inputs.tag }}'
- name: 'No package associated to repository'
if: ${{ steps.switch-case.outputs.match == '0' }}
run: echo 'No package associated'