Skip to content

Commit eef4ce6

Browse files
authored
Merge pull request #5792 from limzykenneth/build-refactor
Refactor and clean up build configurations
2 parents fb6ce7e + 340595a commit eef4ce6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2176
-3381
lines changed

.eslintrc

Lines changed: 0 additions & 35 deletions
This file was deleted.

.eslintrc.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"browser": true,
5+
"amd": true,
6+
"es6": true
7+
},
8+
"globals": {
9+
"p5": true
10+
},
11+
"root": true,
12+
"extends": ["eslint:recommended"],
13+
"parserOptions": {
14+
"ecmaVersion": 2017,
15+
"sourceType": "module"
16+
},
17+
"rules": {
18+
"no-cond-assign": [2, "except-parens"],
19+
"eqeqeq": ["error", "smart"],
20+
"no-use-before-define": [
21+
2,
22+
{
23+
"functions": false
24+
}
25+
],
26+
"new-cap": 0,
27+
"no-caller": 2,
28+
"no-undef": 0,
29+
"no-unused-vars": ["error", { "args": "none" }],
30+
"no-empty": ["error", { "allowEmptyCatch": true }],
31+
"no-console": "off",
32+
"max-len": ["error", {
33+
"code": 80,
34+
"ignoreComments": true,
35+
"ignoreStrings": true,
36+
"ignoreTemplateLiterals": true,
37+
"ignoreRegExpLiterals": true
38+
}],
39+
"indent": ["error", 2, {
40+
"SwitchCase": 1
41+
}],
42+
"semi": ["error", "always"],
43+
"quotes": ["error", "single", {
44+
"avoidEscape": true
45+
}],
46+
"comma-dangle": ["error", "never"],
47+
"object-curly-spacing": ["error", "always"],
48+
"arrow-parens": ["error", "as-needed"],
49+
"linebreak-style": ["error", "unix"],
50+
"no-trailing-spaces": ["error"],
51+
"no-prototype-builtins": "off",
52+
"no-async-promise-executor": "off"
53+
}
54+
}

.github/workflows/release.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: New p5.js release
2+
# Requires secrets `NPM_TOKEN` and `ACCESS_TOKEN` to be set
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
name: Release
13+
steps:
14+
# 1. Setup
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 14
19+
- name: Get version number
20+
id: version-number
21+
run: |
22+
version=$(echo ${{ github.ref_name }} | cut -c 2-)
23+
echo "::set-output name=version::$version"
24+
- name: Install dependencies
25+
run: npm ci
26+
env:
27+
CI: true
28+
- name: Run build
29+
run: npm test
30+
env:
31+
CI: true
32+
- run: rm ./lib/p5-test.js ./lib/p5.pre-min.js
33+
34+
# 2. Prepare release files
35+
- run: mkdir release
36+
- name: Create release zip file
37+
uses: TheDoctor0/[email protected]
38+
with:
39+
type: zip
40+
filename: release/p5.zip
41+
path: ./lib
42+
- name: Copy release files
43+
run: cp lib/p5.js lib/p5.min.js lib/addons/p5.sound.js lib/addons/p5.sound.min.js release/
44+
45+
# 3. Release p5.js
46+
- name: Create GitHub release
47+
uses: softprops/[email protected]
48+
with:
49+
files: release/*
50+
generate_release_notes: true
51+
- name: Publish to NPM
52+
uses: JS-DevTools/npm-publish@v1
53+
with:
54+
token: ${{ secrets.NPM_TOKEN }}
55+
56+
# 4. Update website files
57+
- name: Checkout website repo
58+
uses: actions/checkout@v3
59+
with:
60+
repository: processing/p5.js-website
61+
path: website
62+
fetch-depth: 0
63+
token: ${{ secrets.ACCESS_TOKEN }}
64+
- name: Copy reference files to website repo
65+
run: cp docs/reference/data.* website/src/templates/pages/reference/
66+
- name: Copy library files to website repo
67+
run: cp lib/p5.min.js lib/addons/p5.sound.min.js website/src/assets/js/
68+
- name: Modify version number on website
69+
uses: fjogeleit/[email protected]
70+
with:
71+
valueFile: website/src/data/data.yml
72+
propertyPath: version
73+
value: ${{ steps.version-number.outputs.version }}
74+
commitChange: false
75+
updateFile: true
76+
- name: Update en.json on website repo
77+
run: |
78+
cd website
79+
npm ci
80+
npx grunt generate_enJSON
81+
- name: Commit updated website files
82+
run: |
83+
cd website
84+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
85+
git config --local user.name "github-actions[bot]"
86+
git add .
87+
git commit -m "Update p5.js to ${{ github.ref_name }}"
88+
- name: Push updated website repo
89+
uses: ad-m/[email protected]
90+
with:
91+
github_token: ${{ secrets.ACCESS_TOKEN }}
92+
branch: main
93+
directory: website/
94+
repository: processing/p5.js-website
95+
96+
# 5. Update Bower files
97+
- name: Checkout Bower repo
98+
uses: actions/checkout@v3
99+
with:
100+
repository: processing/p5.js-release
101+
path: bower
102+
fetch-depth: 0
103+
token: ${{ secrets.ACCESS_TOKEN }}
104+
- name: Copy new version files to Bower repo
105+
run: |
106+
cp lib/*.js bower/lib/
107+
cp lib/addons/* bower/lib/addons/
108+
- name: Commit updated Bower files
109+
run: |
110+
cd bower
111+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
112+
git config --local user.name "github-actions[bot]"
113+
git add .
114+
git commit -m "Update p5.js to ${{ github.ref_name }}"
115+
- name: Push updated Bower repo
116+
uses: ad-m/[email protected]
117+
with:
118+
github_token: ${{ secrets.ACCESS_TOKEN }}
119+
branch: master
120+
directory: bower/
121+
repository: processing/p5.js-release

.github/workflows/update-p5jswebsite.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ jobs:
99
runs-on: ubuntu-latest
1010
name: Dispatch event to p5.js-website
1111
steps:
12-
- name: Clone repository
13-
uses: actions/checkout@v1
1412
- name: Dispatch event to p5.js-website
1513
uses: peter-evans/repository-dispatch@v1
1614
with:

0 commit comments

Comments
 (0)