Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and clean up build configurations #5792

Merged
merged 9 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions .eslintrc

This file was deleted.

54 changes: 54 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"env": {
"node": true,
"browser": true,
"amd": true,
"es6": true
},
"globals": {
"p5": true
},
"root": true,
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"rules": {
"no-cond-assign": [2, "except-parens"],
"eqeqeq": ["error", "smart"],
"no-use-before-define": [
2,
{
"functions": false
}
],
"new-cap": 0,
"no-caller": 2,
"no-undef": 0,
"no-unused-vars": ["error", { "args": "none" }],
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-console": "off",
"max-len": ["error", {
"code": 80,
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"indent": ["error", 2, {
"SwitchCase": 1
}],
"semi": ["error", "always"],
"quotes": ["error", "single", {
"avoidEscape": true
}],
"comma-dangle": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"arrow-parens": ["error", "as-needed"],
"linebreak-style": ["error", "unix"],
"no-trailing-spaces": ["error"],
"no-prototype-builtins": "off",
"no-async-promise-executor": "off"
}
}
121 changes: 121 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: New p5.js release
# Requires secrets `NPM_TOKEN` and `ACCESS_TOKEN` to be set

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
release:
runs-on: ubuntu-latest
name: Release
steps:
# 1. Setup
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Get version number
id: version-number
run: |
version=$(echo ${{ github.ref_name }} | cut -c 2-)
echo "::set-output name=version::$version"
- name: Install dependencies
run: npm ci
env:
CI: true
- name: Run build
run: npm test
env:
CI: true
- run: rm ./lib/p5-test.js ./lib/p5.pre-min.js

# 2. Prepare release files
- run: mkdir release
- name: Create release zip file
uses: TheDoctor0/[email protected]
with:
type: zip
filename: release/p5.zip
path: ./lib
- name: Copy release files
run: cp lib/p5.js lib/p5.min.js lib/addons/p5.sound.js lib/addons/p5.sound.min.js release/

# 3. Release p5.js
- name: Create GitHub release
uses: softprops/[email protected]
with:
files: release/*
generate_release_notes: true
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}

# 4. Update website files
- name: Checkout website repo
uses: actions/checkout@v3
with:
repository: processing/p5.js-website
path: website
fetch-depth: 0
token: ${{ secrets.ACCESS_TOKEN }}
- name: Copy reference files to website repo
run: cp docs/reference/data.* website/src/templates/pages/reference/
- name: Copy library files to website repo
run: cp lib/p5.min.js lib/addons/p5.sound.min.js website/src/assets/js/
- name: Modify version number on website
uses: fjogeleit/[email protected]
with:
valueFile: website/src/data/data.yml
propertyPath: version
value: ${{ steps.version-number.outputs.version }}
commitChange: false
updateFile: true
- name: Update en.json on website repo
run: |
cd website
npm ci
npx grunt generate_enJSON
- name: Commit updated website files
run: |
cd website
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "Update p5.js to ${{ github.ref_name }}"
- name: Push updated website repo
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
branch: main
directory: website/
repository: processing/p5.js-website

# 5. Update Bower files
- name: Checkout Bower repo
uses: actions/checkout@v3
with:
repository: processing/p5.js-release
path: bower
fetch-depth: 0
token: ${{ secrets.ACCESS_TOKEN }}
- name: Copy new version files to Bower repo
run: |
cp lib/*.js bower/lib/
cp lib/addons/* bower/lib/addons/
- name: Commit updated Bower files
run: |
cd bower
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "Update p5.js to ${{ github.ref_name }}"
- name: Push updated Bower repo
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
branch: master
directory: bower/
repository: processing/p5.js-release
2 changes: 0 additions & 2 deletions .github/workflows/update-p5jswebsite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ jobs:
runs-on: ubuntu-latest
name: Dispatch event to p5.js-website
steps:
- name: Clone repository
uses: actions/checkout@v1
- name: Dispatch event to p5.js-website
uses: peter-evans/repository-dispatch@v1
with:
Expand Down
Loading