Skip to content

Commit b685e40

Browse files
committed
added support for itchio publishing
1 parent e183372 commit b685e40

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

.github/workflows/build.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,42 @@ jobs:
126126
--uploadFile dist/${{ steps.getfile.outputs.filename }} \
127127
--version ${{ steps.getfile.outputs.version }} \
128128
--releaseNotes "$release_notes"
129+
130+
- name: Check if itch.io variables are set
131+
id: check_itch
132+
run: |
133+
publish=true
134+
if [[ -z "${{ secrets.BUTLER_API_KEY }}" ]]; then
135+
echo "BUTLER_API_KEY is not set. skip itch.io publishing."
136+
publish=false
137+
fi
138+
echo "publish=$publish" >> $GITHUB_OUTPUT
139+
140+
- name: Get Itch.io Page
141+
if: steps.check_itch.outputs.publish == 'true'
142+
id: itchio
143+
run: |
144+
itchioPage=$(grep -oP 'itchioPage:\s?"\K[^"]*' buildconfig.js | cut -d '"' -f 1)
145+
echo "Itch.io Page: $itchioPage"
146+
if [[ -z "$itchioPage" ]]; then
147+
echo "Itch.io Page is not set. skip itch.io publishing."
148+
exit 1
149+
fi
150+
151+
# Extract username and game ID from "username/game-id" format
152+
itchUsername=$(echo "$itchioPage" | cut -d '/' -f 1)
153+
itchGameId=$(echo "$itchioPage" | cut -d '/' -f 2)
154+
155+
echo "username=$itchUsername" >> $GITHUB_OUTPUT
156+
echo "gameId=$itchGameId" >> $GITHUB_OUTPUT
157+
158+
- name: Publish to Itch.io
159+
if: steps.check_itch.outputs.publish == 'true'
160+
uses: KikimoraGames/[email protected]
161+
with:
162+
butlerApiKey: ${{ secrets.BUTLER_API_KEY }}
163+
gameData: dist/${{ steps.getfile.outputs.filename }}
164+
itchUsername: ${{ steps.itchio.outputs.username }}
165+
itchGameId: ${{ steps.itchio.outputs.gameId }}
166+
buildChannel: c3addon
167+
buildNumber: ${{ steps.getfile.outputs.version }}

build/generateDocumentation.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ export default async function generateDocumentation() {
175175
`<b>[Construct Addon Page](${publishConfig.addonUrl})</b> <br>`
176176
);
177177
}
178+
if (
179+
publishConfig &&
180+
publishConfig.itchioPage &&
181+
publishConfig.itchioPage !== ""
182+
) {
183+
readme.push(
184+
`<b>[Itch.io Page](https://itch.io/${publishConfig.itchioPage})</b> <br>`
185+
);
186+
}
178187
if (
179188
config.website &&
180189
config.website !== "" &&

buildconfig.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const disableWarnings = false;
2020
export const terserValidation = "error";
2121

2222
export const publishConfig = {
23-
addonUrl: "",
23+
addonUrl: "", // e.g., "https://www.construct.net/en/make-games/addons/111/my-addon"
24+
itchioPage: "", // e.g., "username/game-id" format like "skymen/my-addon"
2425
autoGenReadme: true,
2526
};

0 commit comments

Comments
 (0)