Skip to content

Release New Version #175

Release New Version

Release New Version #175

Workflow file for this run

name: Release New Version
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type'
required: true
default: 'patch'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out develop
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
ref: develop
# https://stackoverflow.com/a/69634516
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
- name: Setup Git user
uses: fregante/setup-git-user@v1
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- name: Tag release
run: npm version ${{ github.event.inputs.releaseType }}
# Sets new package version as ${{ env.PACKAGE_VERSION }}
- uses: jozsefsallai/node-package-version@v1.0.4
- name: Check out main
uses: actions/checkout@v3
with:
clean: false
fetch-depth: 0
persist-credentials: false
ref: main
- name: Sync branches
run: git merge -m "Merge ${{ github.event.inputs.releaseType }} commit" origin/develop
# Push merge commit back to main and trigger downstream workflows
# https://github.community/t/push-from-action-does-not-trigger-subsequent-action/16854/2
- uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
tags: true
branch: main
- run: PUBLIC_URL='./' npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prepare Web Artifacts
run: zip farmhand-web-${{ env.PACKAGE_VERSION }}.zip -r build/*
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.PACKAGE_VERSION }}
name: ${{ env.PACKAGE_VERSION }}
draft: false
prerelease: false
files: |
./farmhand-web-${{ env.PACKAGE_VERSION }}.zip
- run: node -e "console.log(require('./package.json').version)" > build/version.txt
- name: Publish itch.io build
uses: josephbmanley/butler-publish-itchio-action@master
env:
BUTLER_CREDENTIALS: ${{ secrets.ITCH_TOKEN }}
CHANNEL: html5
ITCH_GAME: Farmhand
ITCH_USER: jeremyckahn
PACKAGE: build
VERSION_FILE: build/version.txt
- run: |
PUBLIC_URL='/farmhand' npm run build
# https://github.com/marketplace/actions/deploy-to-github-pages
- name: Deploy to jeremyckahn.github.io/farmhand
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build
clean: true
single-commit: true
publish_native_build:
needs: release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: true
ref: main
# https://stackoverflow.com/a/69634516
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- name: 'Build and Release Electron App'
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: npm run build:native