Publish #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
# Only trigger, when the build workflow succeeded | |
on: | |
workflow_run: | |
workflows: ["Build"] | |
types: [completed] | |
push: | |
tags: ['[0-9]+.[0-9]+.[0-9]+'] | |
env: | |
tag_name: ${GITHUB_REF##*/} | |
jobs: | |
create_release: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-22.04 | |
name: Create Release | |
steps: | |
- name: Create Draft release | |
run: | | |
gh release create "${{ env.tag_name }}" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="v${{ env.tag_name }}" \ | |
--draft | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish: | |
needs: create_release | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: windows | |
preset: Windows Desktop | |
- platform: linux | |
preset: Linux/X11 | |
# - platform: web | |
# preset: Web | |
- platform: mac | |
preset: macOS | |
name: ${{ matrix.preset }} Publish | |
steps: | |
- name: Download artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: ${{ github.event.workflow_run.workflow_id }} | |
name: Greeter-${{ matrix.platform }}-v${{ env.tag_name }} | |
path: dist/${{ matrix.platform }} | |
skip_unpack: true | |
- name: Upload to release | |
run: | | |
gh release upload "${{ env.tag_name }}" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--clobber \ | |
dist/${{ matrix.platform }}/Greeter-${{ matrix.platform }}-v${{ env.tag_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload to itch.io | |
uses: josephbmanley/butler-publish-itchio-action@v1.0.3 | |
env: | |
BUTLER_CREDENTIALS: ${{ secrets.BUTLER_API_KEY }} | |
CHANNEL: ${{ matrix.platform }}-v${{ env.tag_name }} | |
ITCH_GAME: greeter | |
ITCH_USER: mechanical-flower | |
PACKAGE: dist/${{ matrix.platform }}/Greeter-${{ matrix.platform }}-v${{ env.tag_name }}.zip | |
VERSION: ${{ env.tag_name }} |