Skip to content

1.11.14-rc.2

1.11.14-rc.2 #1

name: New p5.js release
# Requires secrets `NPM_TOKEN` and `ACCESS_TOKEN` to be set
permissions:
contents: write
on:
push:
tags:
- 'v1.*.*' # Push events to matching v*.*.*, i.e. v20.15.10
- 'v1.*.*-*' # Push events to matching v*.*.*-*, i.e. v20.15.10-0
jobs:
release:
runs-on: ubuntu-latest
name: Release
env:
INPUT_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
# 1. Setup
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
persist-credentials: false
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version: 22
- name: Check prerelease
id: semver
shell: bash
run: |
if [[ "${{ github.ref_name }}" == *"-rc"* ]]; then
echo "is-prerelease=true" >> $GITHUB_OUTPUT
else
echo "is-prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Get version number
id: version-number
run: |
version=$(echo ${{ github.ref_name }} | cut -c 2-)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Get current date
id: date
run: echo "date=$(date +"%B %Oe, %Y")" >> $GITHUB_OUTPUT
- 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 && mkdir p5 && cp -r ./lib/* p5/
- name: Create release zip file
uses: TheDoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 # 0.6.2
with:
type: zip
filename: release/p5.zip
path: ./p5/*
- 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/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
with:
draft: true
prerelease: ${{ steps.semver.outputs.is-prerelease == 'true' }}
files: release/*
generate_release_notes: true
token: ${{ secrets.ACCESS_TOKEN }}
- name: Publish to NPM
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 # v1
with:
token: ${{ secrets.NPM_TOKEN }}
tag: r1
# 4. Update p5.js website
- name: Clone p5.js website
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
repository: processing/p5.js-website
path: website
fetch-depth: 0
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: false
- name: Updated website files
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
run: |
cd website
npm install
npm run build:p5-version
npm run build:contributor-docs
npm run build:contributors
npm run build:reference
npm run build:search
- name: Commit updated website files
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
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
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
uses: ad-m/github-push-action@40bf560936a8022e68a3c00e7d2abefaf01305a6 # v0.6.0
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
branch: v1
directory: website/
repository: processing/p5.js-website
# 5. Update Bower files
- name: Checkout Bower repo
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
repository: processing/p5.js-release
path: bower
fetch-depth: 0
token: ${{ secrets.ACCESS_TOKEN }}
persist-credentials: false
- name: Copy new version files to Bower repo
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
run: |
cp lib/*.js bower/lib/
cp lib/addons/* bower/lib/addons/
- name: Commit updated Bower files
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
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
if: ${{ steps.semver.outputs.is-prerelease != 'true' }}
uses: ad-m/github-push-action@40bf560936a8022e68a3c00e7d2abefaf01305a6 # v0.6.0
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
branch: master
directory: bower/
repository: processing/p5.js-release