-
Notifications
You must be signed in to change notification settings - Fork 4
82 lines (66 loc) · 2.11 KB
/
Copy pathpublish.yml
File metadata and controls
82 lines (66 loc) · 2.11 KB
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
name: Publish On NPMJS
on:
pull_request:
types:
- closed
branches:
- main
jobs:
publish:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
registry-url: https://registry.npmjs.org/
- name: Set Git Config
run: |
git config --global user.email "ci-build@aemforms"
git config --global user.name "ci-build"
env:
GITHUB_TOKEN: ${{ secrets.ADOBE_GH_TOKEN }}
GH_TOKEN: ${{ secrets.ADOBE_GH_TOKEN }}
- name: Install dependencies
run: npm install
- name: Build theme
run: npm run build
- name: Authenticate with NPM Registry
run: |
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_DEPLOY_TOKEN }}
- name: Discard Uncommitted Changes
run: git reset --hard
- name: Get current version
id: get_version
run: echo ::set-output name=version::$(node -p "require('./package.json').version")
- name: Bump version
id: bump_version
run: |
npm version patch -m "Bump version to %s"
- name: Backup original package.json
run: cp package.json package.json.bak
- name: Modify package.json for scoped publish
run: |
jq '.name = "@aemforms/af-fsi-theme"' package.json > package.json.tmp && mv package.json.tmp package.json
- name: Publish to npm
run: |
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_DEPLOY_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_DEPLOY_TOKEN }}
- name: Restore original package.json
run: mv package.json.bak package.json
- name: Push changes to remote repository
run: git push origin HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.ADOBE_GH_TOKEN }}
GH_TOKEN: ${{ secrets.ADOBE_GH_TOKEN }}