Skip to content

Commit f6ea77c

Browse files
committed
fix: Adapting release workflow for legacy godot3 branches
1 parent 1aec079 commit f6ea77c

File tree

1 file changed

+168
-160
lines changed

1 file changed

+168
-160
lines changed

.github/workflows/release.yml

Lines changed: 168 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,180 @@
11
name: Release
22

33
on:
4-
push:
5-
branches:
6-
- 'main'
7-
- 'develop'
4+
push:
5+
branches:
6+
- godot3
7+
- godot3-develop
88

99
# Allows you to run this workflow manually from the Actions tab
1010
workflow_dispatch:
1111

1212
permissions:
13-
contents: write
13+
contents: write
1414

1515
env:
16-
ADDON_NAME: godot-playfab
17-
ITCH_USERNAME: structed
18-
ITCH_GAME_ID: godot-playfab
19-
ASSET_LIB_USERNAME: structed
20-
ASSET_LIB_ASSET_ID: 1321
16+
ADDON_NAME: godot-playfab
17+
ITCH_USERNAME: structed
18+
ITCH_GAME_ID: godot-playfab
19+
ASSET_LIB_USERNAME: structed
20+
ASSET_LIB_ASSET_ID: 7458
2121

2222
jobs:
23-
prerelease:
24-
if: "github.event.head_commit.message != 'Release preparation: storing Version and Changelog'"
25-
name: Preparing release
26-
runs-on: ubuntu-latest
27-
outputs:
28-
version: ${{ steps.calculate_version.outputs.new_version }}
29-
tag: ${{ steps.calculate_version.outputs.new_tag }}
30-
changelog: ${{ steps.calculate_version.outputs.changelog }}
31-
steps:
32-
- uses: actions/checkout@v3
33-
with:
34-
fetch-depth: 0
35-
token: ${{ secrets.PAT }}
36-
37-
- name: Calculate version
38-
id: calculate_version
39-
uses: mathieudutour/[email protected]
40-
with:
41-
tag_prefix: ""
42-
github_token: ${{ secrets.PAT }}
43-
dry_run: true
44-
default_bump: false
45-
custom_release_rules: |
46-
"fix:patch:Bug Fixes,hotfix:patch:Bug Fixes,feature:minor:Features,change:minor:Changes,breaking:major:Breaking Changes,major:major:Major Changes"
47-
48-
- name: "Write changelog"
49-
run: |
50-
CHANGELOG=""
51-
if [ -e addons/${{env.ADDON_NAME}}/CHANGELOG.md ]
52-
then
53-
CHANGELOG=$(cat addons/${{env.ADDON_NAME}}/CHANGELOG.md)
54-
fi
55-
echo -e "${{steps.calculate_version.outputs.changelog}}\n\n${CHANGELOG}" > addons/${{env.ADDON_NAME}}/CHANGELOG.md
56-
if: github.ref == 'refs/heads/main' && steps.calculate_version.outputs.new_version != ''
57-
58-
- name: "Update version in plugin.cfg"
59-
run: |
60-
sed -i -re 's/version=".+$/version="${{ steps.calculate_version.outputs.new_version }}"/gi' addons/${{env.ADDON_NAME}}/plugin.cfg
61-
if: steps.calculate_version.outputs.new_version != ''
62-
63-
- name: "Commit"
64-
uses: EndBug/[email protected]
65-
with:
66-
message: 'Release preparation: storing Version and Changelog'
67-
push: true
68-
if: github.ref == 'refs/heads/main' && steps.calculate_version.outputs.new_version != ''
69-
70-
release:
71-
# Create release only after the version was bumped and release notes added:
72-
if: "github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
73-
runs-on: ubuntu-latest
74-
75-
steps:
76-
77-
- uses: actions/checkout@v3
78-
with:
79-
fetch-depth: 0
80-
token: ${{ secrets.GITHUB_TOKEN }}
81-
82-
- name: Create version
83-
id: create_version
84-
uses: mathieudutour/[email protected]
85-
with:
86-
tag_prefix: ""
87-
dry_run: ${{ github.ref_name != 'main' }}
88-
github_token: ${{ secrets.GITHUB_TOKEN }}
89-
default_bump: false
90-
91-
- name: Upload artifact
92-
uses: actions/upload-artifact@v3
93-
with:
94-
name: ${{env.ADDON_NAME}}-${{ steps.create_version.outputs.new_tag }}
95-
path: addons/${{env.ADDON_NAME}}/
96-
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
97-
if: steps.create_version.outputs.new_version != ''
98-
99-
- name: Create Release
100-
uses: ncipollo/[email protected]
101-
with:
102-
name: ${{ steps.create_version.outputs.new_tag }}
103-
body: ${{ steps.create_version.outputs.changelog }}
104-
draft: false
105-
prerelease: ${{ github.ref_name != 'main' }}
106-
latest: ${{ github.ref_name != 'main' }}
107-
artifacts: ""
108-
replacesArtifacts: false
109-
generateReleaseNotes: true
110-
token: ${{ secrets.GITHUB_TOKEN }}
111-
tag: ${{ steps.create_version.outputs.new_tag }}
112-
if: steps.create_version.outputs.new_version != ''
113-
114-
itch:
115-
if: "github.ref == 'refs/heads/main' && github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
116-
runs-on: ubuntu-latest
117-
needs: release
118-
119-
steps:
120-
121-
- name: Calculate version
122-
id: calculate_version
123-
uses: mathieudutour/[email protected]
124-
with:
125-
tag_prefix: "v"
126-
github_token: ${{ secrets.PAT }}
127-
dry_run: true
128-
default_bump: false
129-
130-
# Using https://github.com/KikimoraGames/itch-publish
131-
- uses: actions/download-artifact@v3
132-
with:
133-
name: ${{env.ADDON_NAME}}-${{ steps.calculate_version.outputs.previous_tag }}
134-
path: addons/${{env.ADDON_NAME}}/
135-
136-
- uses: KikimoraGames/[email protected]
137-
with:
138-
butlerApiKey: ${{secrets.ITCHIO_SECRET}}
139-
gameData: .
140-
itchUsername: ${{env.ITCH_USERNAME}}
141-
itchGameId: ${{ env.ITCH_GAME_ID }}
142-
buildChannel: windows-mac-linux
143-
buildNumber: ${{ steps.calculate_version.outputs.previous_tag }}
144-
145-
assetlib:
146-
if: "github.ref == 'refs/heads/main' && github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
147-
runs-on: ubuntu-latest
148-
needs: release
149-
name: Godot AssetLib
150-
steps:
151-
152-
- uses: actions/checkout@v3
153-
154-
- name: Calculate version
155-
id: calculate_version
156-
uses: mathieudutour/[email protected]
157-
with:
158-
tag_prefix: "v"
159-
github_token: ${{ secrets.PAT }}
160-
dry_run: true
161-
default_bump: false
162-
163-
- name: Set Version
164-
run: |
165-
echo "version=${{ steps.calculate_version.outputs.previous_tag }}" >> $GITHUB_ENV
166-
167-
- name: Godot Asset Lib
168-
uses: deep-entertainment/[email protected]
169-
with:
170-
username: ${{ env.ASSET_LIB_USERNAME }}
171-
password: ${{ secrets.ASSET_LIB_PASSWORD }}
172-
assetId: ${{ env.ASSET_LIB_ASSET_ID }}
23+
prerelease:
24+
if: "github.event.head_commit.message != 'Release preparation: storing Version and Changelog'"
25+
name: Preparing release
26+
runs-on: ubuntu-latest
27+
outputs:
28+
version: ${{ steps.calculate_version.outputs.new_version }}
29+
tag: ${{ steps.calculate_version.outputs.new_tag }}
30+
changelog: ${{ steps.calculate_version.outputs.changelog }}
31+
steps:
32+
- uses: actions/checkout@v3
33+
with:
34+
fetch-depth: 0
35+
token: ${{ secrets.PAT }}
36+
37+
- name: Calculate version
38+
id: calculate_version
39+
uses: mathieudutour/[email protected]
40+
with:
41+
tag_prefix: ""
42+
github_token: ${{ secrets.PAT }}
43+
dry_run: true
44+
default_bump: false
45+
release_branches: godot3
46+
pre_release_branches: godot3-develop
47+
custom_release_rules: |
48+
"fix:patch:Bug Fixes,hotfix:patch:Bug Fixes,feature:minor:Features,change:minor:Changes,breaking:major:Breaking Changes,major:major:Major Changes"
49+
50+
- name: "Write changelog"
51+
run: |
52+
CHANGELOG=""
53+
if [ -e addons/${{env.ADDON_NAME}}/CHANGELOG.md ]
54+
then
55+
CHANGELOG=$(cat addons/${{env.ADDON_NAME}}/CHANGELOG.md)
56+
fi
57+
echo -e "${{steps.calculate_version.outputs.changelog}}\n\n${CHANGELOG}" > addons/${{env.ADDON_NAME}}/CHANGELOG.md
58+
if: github.ref == 'refs/heads/godot3' && steps.calculate_version.outputs.new_version != ''
59+
60+
- name: "Update version in plugin.cfg"
61+
run: |
62+
sed -i -re 's/version=".+$/version="${{ steps.calculate_version.outputs.new_version }}"/gi' addons/${{env.ADDON_NAME}}/plugin.cfg
63+
if: steps.calculate_version.outputs.new_version != ''
64+
65+
- name: "Commit"
66+
uses: EndBug/[email protected]
67+
with:
68+
message: 'Release preparation: storing Version and Changelog'
69+
push: true
70+
if: github.ref == 'refs/heads/godot3' && steps.calculate_version.outputs.new_version != ''
71+
72+
release:
73+
# Create release only after the version was bumped and release notes added:
74+
if: "github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
75+
runs-on: ubuntu-latest
76+
77+
steps:
78+
79+
- uses: actions/checkout@v3
80+
with:
81+
fetch-depth: 0
82+
token: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: Create version
85+
id: create_version
86+
uses: mathieudutour/[email protected]
87+
with:
88+
tag_prefix: ""
89+
dry_run: ${{ github.ref_name != 'godot3' }}
90+
github_token: ${{ secrets.GITHUB_TOKEN }}
91+
default_bump: false
92+
release_branches: godot3
93+
pre_release_branches: godot3-develop
94+
95+
- name: Upload artifact
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: ${{env.ADDON_NAME}}-${{ steps.create_version.outputs.new_tag }}
99+
path: addons/${{env.ADDON_NAME}}/
100+
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
101+
if: steps.create_version.outputs.new_version != ''
102+
103+
- name: Create Release
104+
uses: ncipollo/[email protected]
105+
with:
106+
name: ${{ steps.create_version.outputs.new_tag }}
107+
body: ${{ steps.create_version.outputs.changelog }}
108+
draft: false
109+
prerelease: ${{ github.ref_name != 'godot3' }}
110+
latest: ${{ github.ref_name != 'godot3' }}
111+
artifacts: ""
112+
replacesArtifacts: false
113+
generateReleaseNotes: true
114+
token: ${{ secrets.GITHUB_TOKEN }}
115+
tag: ${{ steps.create_version.outputs.new_tag }}
116+
if: steps.create_version.outputs.new_version != ''
117+
118+
itch:
119+
if: "github.ref == 'refs/heads/godot3' && github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
120+
runs-on: ubuntu-latest
121+
needs: release
122+
123+
steps:
124+
125+
- name: Calculate version
126+
id: calculate_version
127+
uses: mathieudutour/[email protected]
128+
with:
129+
tag_prefix: "v"
130+
github_token: ${{ secrets.PAT }}
131+
dry_run: true
132+
default_bump: false
133+
release_branches: godot3
134+
pre_release_branches: godot3-develop
135+
136+
# Using https://github.com/KikimoraGames/itch-publish
137+
- uses: actions/download-artifact@v3
138+
with:
139+
name: ${{env.ADDON_NAME}}-${{ steps.calculate_version.outputs.previous_tag }}
140+
path: addons/${{env.ADDON_NAME}}/
141+
142+
- uses: KikimoraGames/[email protected]
143+
with:
144+
butlerApiKey: ${{secrets.ITCHIO_SECRET}}
145+
gameData: .
146+
itchUsername: ${{env.ITCH_USERNAME}}
147+
itchGameId: ${{ env.ITCH_GAME_ID }}
148+
buildChannel: windows-mac-linux
149+
buildNumber: ${{ steps.calculate_version.outputs.previous_tag }}
150+
151+
assetlib:
152+
if: "github.ref == 'refs/heads/godot3' && github.event.head_commit.message == 'Release preparation: storing Version and Changelog'"
153+
runs-on: ubuntu-latest
154+
needs: release
155+
name: Godot AssetLib
156+
steps:
157+
158+
- uses: actions/checkout@v3
159+
160+
- name: Calculate version
161+
id: calculate_version
162+
uses: mathieudutour/[email protected]
163+
with:
164+
tag_prefix: "v"
165+
github_token: ${{ secrets.PAT }}
166+
dry_run: true
167+
default_bump: false
168+
release_branches: godot3
169+
pre_release_branches: godot3-develop
170+
171+
- name: Set Version
172+
run: |
173+
echo "version=${{ steps.calculate_version.outputs.previous_tag }}" >> $GITHUB_ENV
174+
175+
- name: Godot Asset Lib
176+
uses: deep-entertainment/[email protected]
177+
with:
178+
username: ${{ env.ASSET_LIB_USERNAME }}
179+
password: ${{ secrets.ASSET_LIB_PASSWORD }}
180+
assetId: ${{ env.ASSET_LIB_ASSET_ID }}

0 commit comments

Comments
 (0)