Skip to content

Commit

Permalink
ci(github): upload to itch.io in workflow release-please.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Feb 27, 2024
1 parent 7456f40 commit be92a14
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,51 @@ on:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}

steps:
- name: Release Please
uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: node

publish:
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: .nvmrc

- name: Install dependencies
run: npm ci --prefer-offline

- name: Read package version
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV

- name: Build
run: npm run bundle

- name: Setup butler
uses: remarkablegames/setup-butler@v1

- name: Upload to itch.io
run: butler push dist ${{ github.repository }}:html5 --userversion ${{ env.VERSION }}
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
12 changes: 7 additions & 5 deletions scripts/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
BUNDLE=true npm run build

# replace absolute URLs with relative URLs
if [ "$(uname)" == 'Darwin' ]; then
if [[ $(uname) == 'Darwin' ]]; then
sed -i '' -e 's|src="/|src="|g' -e 's|href="/|href="|g' dist/index.html
else
sed -i -e 's|src="/|src="|g' -e 's|href="/|href="|g' dist/index.html
fi

# zip file
zip -r "dist/$(npm pkg get name | tr -d \")-$(npm pkg get version | tr -d \").zip" dist
echo
find dist -type f -depth 1 -name '*.zip'
open dist
if [[ $CI != 'true' ]]; then
zip -r "dist/$(npm pkg get name | tr -d \")-$(npm pkg get version | tr -d \").zip" dist
echo
find dist -type f -depth 1 -name '*.zip'
open dist
fi

0 comments on commit be92a14

Please sign in to comment.