Skip to content

balance tweaks

balance tweaks #22

name: Publish Godot builds to Itch.io
on:
push:
branches:
- main
paths:
- '**.tscn'
- '**.gd'
pull_request:
branches:
- main
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} # Needs to be added through github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GODOT_VERSION: 4.2.1
jobs:
CleanArtifacts:
# This job clears out the previous artifacts made so you don't run out of space in your github account
runs-on: ubuntu-latest
steps:
- uses: kolpav/purge-artifacts-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 1hr
GenerateGodotBuilds:
needs: CleanArtifacts # wait for artifacts to clean before making a new one
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download + Authorize Godot
run: |
curl -sL -o godot.zip https://downloads.tuxfamily.org/godotengine/${{ vars.GODOT_VERSION }}/Godot_v${{ vars.GODOT_VERSION }}-stable_linux.x86_64.zip
unzip godot.zip
mv Godot_v${{ vars.GODOT_VERSION }}-stable_linux.x86_64 godot
chmod +x godot
- name: Prepare Export Templates
run: |
curl -sL -o export_templates.zip https://downloads.tuxfamily.org/godotengine/${{ vars.GODOT_VERSION }}/Godot_v${{ vars.GODOT_VERSION }}-stable_export_templates.tpz
unzip export_templates.zip
mkdir -p ~/.local/share/godot/export_templates/${{ vars.GODOT_VERSION }}.stable
mv ./templates/* ~/.local/share/godot/export_templates/${{ vars.GODOT_VERSION }}.stable
- name: Godot Build Windows Desktop
run: |
mkdir -p ./build
./godot --headless --path ./ --export-release "Windows Desktop" ./build/${{vars.ITCH_PROJECT_NAME}}.exe
- name: Godot Build HTML5/Web
run: |
mkdir -p ./build/${{vars.ITCH_PROJECT_NAME}}-html
./godot --headless --path ./ --export-release "Web" ./build/${{vars.ITCH_PROJECT_NAME}}-html/index.html
zip -mjr ./build/${{vars.ITCH_PROJECT_NAME}}.zip ./build/${{vars.ITCH_PROJECT_NAME}}-html/*
- name: Godot Build Linux/X11
run: |
mkdir -p ./build
./godot --headless --path ./ --export-release "Linux/X11" ./build/${{vars.ITCH_PROJECT_NAME}}
- name: Upload Godot Builds as workflow artifacts
uses: actions/upload-artifact@v3
with:
name: builds
path: ./build
GithubRelease:
needs: GenerateGodotBuilds
if: ${{ contains(github.ref, 'main') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Version
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Tag
if: ${{ !steps.tag_version.outputs.new_tag }}
run: exit 1
- name: Retrieve Godot Builds
uses: actions/download-artifact@v3
with:
name: builds
path: ./builds
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: ${{vars.ITCH_PROJECT_NAME}} ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Upload Release Windows Godot Build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./builds/${{vars.ITCH_PROJECT_NAME}}.exe
asset_name: ${{vars.ITCH_PROJECT_NAME}}-windows.exe
asset_content_type: application/octet-stream
- name: Upload Release Linux Godot Build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./builds/${{vars.ITCH_PROJECT_NAME}}
asset_name: ${{vars.ITCH_PROJECT_NAME}}-linux
asset_content_type: application/octet-stream
- name: Upload Release Web/HTML5 Godot Build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./builds/${{vars.ITCH_PROJECT_NAME}}.zip
asset_name: ${{vars.ITCH_PROJECT_NAME}}-html.zip
asset_content_type: application/zip
- uses: frdrwrt/write-to-file@v1.3
with:
filepath: ./VERSION.txt
content: ${{ steps.tag_version.outputs.new_version }}
mode: 0655
- uses: actions/upload-artifact@v2
with:
name: VERSION
path: ./VERSION.txt
ItchIOPublish:
needs: GithubRelease
if: ${{ contains(github.ref, 'main') }}
runs-on: ubuntu-latest
steps:
- name: Retrieve Godot Builds
uses: actions/download-artifact@v3
with:
name: builds
path: ./builds
- name: Download + Authorize Butler
run: |
curl -sL -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
./butler -V
- name: Login To Butler
run: ./butler login
- name: Butler upload binary builds
run: |
./butler push ./builds/${{vars.ITCH_PROJECT_NAME}} ricargoes/${{vars.ITCH_PROJECT_NAME}}:linux
./butler push ./builds/${{vars.ITCH_PROJECT_NAME}}.exe ricargoes/${{vars.ITCH_PROJECT_NAME}}:windows
- name: Butler upload HTML5/Web build
run: ./butler push ./builds/${{vars.ITCH_PROJECT_NAME}}.zip ricargoes/${{vars.ITCH_PROJECT_NAME}}:HTML
Cleanup:
needs: ItchIOPublish
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: VERSION