Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
env:
# update with the name of the main binary
binary: bevy_github_ci_template
add_binaries_to_github_release: true
#itch_target: <itch.io-username>/<game-name>


jobs:
Expand Down Expand Up @@ -43,7 +45,14 @@ jobs:
files: wasm
dest: ${{ env.binary }}.zip

- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.zip
name: wasm

- name: Upload binaries to release
if: ${{ env.add_binaries_to_github_release == 'true' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -84,7 +93,14 @@ jobs:
files: linux
dest: ${{ env.binary }}.zip

- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.zip
name: linux

- name: Upload binaries to release
if: ${{ env.add_binaries_to_github_release == 'true' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -122,7 +138,14 @@ jobs:
files: windows
dest: ${{ env.binary }}.zip

- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.zip
name: windows

- name: Upload binaries to release
if: ${{ env.add_binaries_to_github_release == 'true' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -160,11 +183,67 @@ jobs:
cp -r assets ${{ env.binary }}.app/Contents/MacOS/
hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}.dmg

- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.dmg
name: mac

- name: Upload binaries to release
if: ${{ env.add_binaries_to_github_release == 'true' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.dmg
asset_name: ${{ env.binary }}-macos-${{ steps.get_version.outputs.tag }}.dmg
tag: ${{ github.ref }}
overwrite: true

check-if-upload-to-itch-is-configured:
runs-on: ubuntu-latest
outputs:
should-upload: ${{ steps.check-env.outputs.has-itch-target }}
steps:
- id: check-env
run: |
if [[ -z "$itch_target" ]]; then
echo "::set-output name=has-itch-target::no"
else
echo "::set-output name=has-itch-target::yes"
fi

upload-to-itch:
runs-on: ubuntu-latest
needs:
- check-if-upload-to-itch-is-configured
- release-wasm
- release-linux
- release-windows
- release-macos
if: ${{ needs.check-if-upload-to-itch-is-configured.outputs.should-upload == 'yes' }}

steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./builds

- name: Install butler
run: |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
unzip butler.zip
chmod +x butler
./butler -V
- uses: little-core-labs/get-git-tag@v3.0.1
id: get_version
- name: Upload to itch.io
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_CREDENTIALS }}
run: |
for channel in $(ls builds); do
./butler push \
--fix-permissions \
--userversion="${{ steps.get_version.outputs.tag }}" \
builds/$channel/* \
${{ env.itch_target }}:$channel
done
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ It will build:

If you don't want to target some of those platforms, you can remove the corresponding job from the file [release.yaml](./.github/workflows/release.yaml).

If you don't want to attach the builds to the GitHub release, set `env.add_binaries_to_github_release` to `false`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a bit more detail on how exactly this is done; the target audience is novice programmers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can put before&after of the relevant YAML section?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That may be more confusing.
I think just explaining in more descriptive way how you don't need to store binaries on GitHub to get them on Itch would be enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... move this to the new ### Publish on itch.io section (which already requires that you touch env) and explain it at that context?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a new section ### Publish on GitHub release could be nice and mirror the new ### Publish on itch.io
(and would be easy to expand if we add more targets later, an easy one would be a publish to GitHub page with a custom html and/or the wasm version for example)


### Git Tag from GitHub UI

You can follow [Managing releases in a repository](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository)
Expand All @@ -53,3 +55,13 @@ A new release will be available in GitHub, with the archives per platform availb

The `git` commands above produced this release: [my-game-1.0](
https://github.com/bevyengine/bevy_github_ci_template/releases/tag/my-game-1.0).

### Publish on itch.io

The release flow can be configured to push the releases to itch.io:

1. Create an API key in https://itch.io/user/settings/api-keys
2. Go to the repository's Settings tab in GitHub, click on Secrets->Actions in the sidebar,and add a repository secret named `BUTLER_CREDENTIALS` set to the API key.
3. Uncomment `env.itch_target` in `release.yaml` and set it to the itch.io username and the name of the game on itch.io, separated by a slash (`/`)

Once that is done, any tag pushed to GitHub will trigger an itch.io release and use the tag as the [user version](https://itch.io/docs/butler/pushing.html#specifying-your-own-version-number).