Publish #1
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] | |
env: | |
tag_name: ${{ github.event.workflow_run.head_branch }} | |
jobs: | |
create_release: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-22.04 | |
name: Create Release | |
steps: | |
- name: Check Tag | |
run: | | |
if [[ ! ${{ env.tag_name }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
exit 1 | |
fi | |
- 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: Marble-${{ 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 }}/Marble-${{ matrix.platform }}-v${{ env.tag_name }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload to itch.io | |
uses: josephbmanley/[email protected] | |
env: | |
BUTLER_CREDENTIALS: ${{ secrets.BUTLER_API_KEY }} | |
CHANNEL: ${{ matrix.platform }} | |
ITCH_GAME: Marble | |
ITCH_USER: mechanical-flower | |
PACKAGE: dist/${{ matrix.platform }}/Marble-${{ matrix.platform }}-v${{ env.tag_name }}.zip | |
VERSION: ${{ env.tag_name }} |