-
Notifications
You must be signed in to change notification settings - Fork 32
72 lines (57 loc) · 1.74 KB
/
publish-npm.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
name: NPM Components Package Publish
on:
push:
branches:
- master-old
workflow_dispatch:
permissions:
contents: write
jobs:
build:
if: contains(github.event.head_commit.message, 'publish-npm')
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.0.0]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
node-version: ${{ matrix.node-version }}
- name: Update Git Config
run: |
# Modify git config to add user name and email
git config user.name "Paul Lobo (Auto)"
git config user.email "[email protected]"
shell: bash
- name: Bump version
run: npm version patch
- name: Get new version
run: |
npm_version=$(node -p "require('./package.json').version")
echo "NPM_VERSION=$npm_version" >> $GITHUB_ENV
echo "New version: $npm_version" # Add this line to debug
- name: Get new version
run: echo "$NPM_VERSION"
- name: Install Dependencies
run: rm -rf dist && npm ci
- name: List Files
run: ls -R
- name: Build Package
run: npm run build-bundle
- name: Login to npm
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Package
run: npm publish
- name: Stage changes
run: git add .
- name: Sync changes
run: git pull
- name: Commit changes
run: |
git add package.json
git commit -m "[Auto] Publish changes to NPM ::: bump version to $(npm version patch)"
- name: Push changes
run: git push