-
Notifications
You must be signed in to change notification settings - Fork 905
59 lines (56 loc) · 2 KB
/
publish.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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
release:
types: [released]
branches:
- main
jobs:
npm-publishing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Reconfigure git to use HTTP authentication
run: >
git config --global url."https://github.com/".insteadOf
ssh://[email protected]/
- uses: actions/setup-node@v2
with:
node-version: "12.x"
registry-url: https://registry.npmjs.org/
- uses: pozetroninc/github-action-get-latest-release@master
id: latest_release
with:
repository: ${{ github.repository }}
# - uses: release-drafter/release-drafter@v5
# id: release_drafter
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: echo "bumping package to ${{ steps.latest_release.outputs.release }}"
# bump the package version
- run: npm run update:packageVersion ${{ steps.latest_release.outputs.release }}
# bump the readme
- run: npm run update:readme
# install packages
- run: npm ci
# commit the package, package-lock, and readme changes
- name: Commit
run: |
git config --global user.name 'ml5'
git config --global user.email '[email protected]'
git commit -am "bumps package, readme, and package-lock"
# push changes to main
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ML5_LIBRARY_PAT }}
branch: main
# build it!
- run: npm run build
# publish with the name - should only be the numbers like 0.9.5
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}