forked from processing/p5.js
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (129 loc) · 4.44 KB
/
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
132
133
134
135
136
137
name: New p5.js release
# Requires secrets `NPM_TOKEN` and `ACCESS_TOKEN` to be set
permissions:
contents: write
on:
push:
tags:
- 'v*.*.*' # Push events to matching v*.*.*, i.e. v20.15.10
jobs:
release:
runs-on: ubuntu-latest
name: Release
env:
INPUT_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
# 1. Setup
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- 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/[email protected]
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/[email protected]
with:
draft: true
files: release/*
generate_release_notes: true
token: ${{ secrets.ACCESS_TOKEN }}
- 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 version.json on website repo
uses: restackio/[email protected]
with:
file: website/dist/download/version.json
fields: '{"version": "${{ steps.version-number.outputs.version }}", "date": "${{ steps.date.outputs.date }}"}'
- 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