-
Notifications
You must be signed in to change notification settings - Fork 14
174 lines (149 loc) · 5.75 KB
/
release-godot4.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Release Godot 4
on:
push:
branches:
- main
- master
- develop
- godot4
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
env:
ADDON_NAME: godot-playfab
ITCH_USERNAME: structed
ITCH_GAME_ID: godot-playfab
ASSET_LIB_USERNAME: structed
ASSET_LIB_ASSET_ID: 1321
jobs:
prerelease:
if: "github.event.head_commit.message != 'Release preparation: storing Version and Changelog'"
name: Preparing release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.calculate_version.outputs.new_version }}
tag: ${{ steps.calculate_version.outputs.new_tag }}
changelog: ${{ steps.calculate_version.outputs.changelog }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Calculate version
id: calculate_version
uses: mathieudutour/github-tag-action@v6.1
with:
tag_prefix: ""
github_token: ${{ secrets.PAT }}
dry_run: true
default_bump: false
custom_release_rules: |
"fix:patch:Bug Fixes,hotfix:patch:Bug Fixes,feature:minor:Features,change:minor:Changes,breaking:major:Breaking Changes,major:major:Major Changes"
- name: "Write changelog"
run: |
CHANGELOG=""
if [ -e addons/${{env.ADDON_NAME}}/CHANGELOG.md ]
then
CHANGELOG=$(cat addons/${{env.ADDON_NAME}}/CHANGELOG.md)
fi
echo -e "${{steps.calculate_version.outputs.changelog}}\n\n${CHANGELOG}" > addons/${{env.ADDON_NAME}}/CHANGELOG.md
if: github.ref == 'refs/heads/main' && steps.calculate_version.outputs.new_version != ''
- name: "Update version in plugin.cfg"
run: |
sed -i -re 's/version=".+$/version="${{ steps.calculate_version.outputs.new_version }}"/gi' addons/${{env.ADDON_NAME}}/plugin.cfg
if: steps.calculate_version.outputs.new_version != ''
- name: "Commit"
uses: EndBug/add-and-commit@v9.1.1
with:
message: 'Release preparation: storing Version and Changelog'
push: true
if: github.ref == 'refs/heads/main' && steps.calculate_version.outputs.new_version != ''
release:
# Create release only after the version was bumped and release notes added:
if: "github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create version
id: create_version
uses: mathieudutour/github-tag-action@v6.1
with:
tag_prefix: ""
dry_run: ${{ github.ref_name != 'main' }}
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{env.ADDON_NAME}}-${{ steps.create_version.outputs.new_tag }}
path: addons/${{env.ADDON_NAME}}/
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
if: steps.create_version.outputs.new_version != ''
- name: Create Release
uses: ncipollo/release-action@v1.12.0
with:
name: ${{ steps.create_version.outputs.new_tag }}
body: ${{ steps.create_version.outputs.changelog }}
draft: false
prerelease: ${{ github.ref_name != 'main' }}
latest: ${{ github.ref_name != 'main' }}
artifacts: ""
replacesArtifacts: false
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.create_version.outputs.new_tag }}
if: steps.create_version.outputs.new_version != ''
itch:
if: "github.ref == 'refs/heads/main' && github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
runs-on: ubuntu-latest
needs: release
steps:
- name: Calculate version
id: calculate_version
uses: mathieudutour/github-tag-action@v6.1
with:
tag_prefix: "v"
github_token: ${{ secrets.PAT }}
dry_run: true
default_bump: false
# Using /~https://github.com/KikimoraGames/itch-publish
- uses: actions/download-artifact@v3
with:
name: ${{env.ADDON_NAME}}-${{ steps.calculate_version.outputs.previous_tag }}
path: addons/${{env.ADDON_NAME}}/
- uses: KikimoraGames/itch-publish@v0.0.3
with:
butlerApiKey: ${{secrets.ITCHIO_SECRET}}
gameData: .
itchUsername: ${{env.ITCH_USERNAME}}
itchGameId: ${{ env.ITCH_GAME_ID }}
buildChannel: windows-mac-linux
buildNumber: ${{ steps.calculate_version.outputs.previous_tag }}
assetlib:
if: "github.ref == 'refs/heads/main' && github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
runs-on: ubuntu-latest
needs: release
name: Godot AssetLib
steps:
- uses: actions/checkout@v3
- name: Calculate version
id: calculate_version
uses: mathieudutour/github-tag-action@v6.1
with:
tag_prefix: "v"
github_token: ${{ secrets.PAT }}
dry_run: true
default_bump: false
- name: Set Version
run: |
echo "version=${{ steps.calculate_version.outputs.previous_tag }}" >> $GITHUB_ENV
- name: Godot Asset Lib
uses: deep-entertainment/godot-asset-lib-action@v0.4.0
with:
username: ${{ env.ASSET_LIB_USERNAME }}
password: ${{ secrets.ASSET_LIB_PASSWORD }}
assetId: ${{ env.ASSET_LIB_ASSET_ID }}