-
Notifications
You must be signed in to change notification settings - Fork 28
131 lines (113 loc) · 3.85 KB
/
run-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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://[email protected]/
- 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/[email protected]
- 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://[email protected]/
- 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