Skip to content

Commit b697110

Browse files
committed
Change publish process.
1 parent 2870d85 commit b697110

File tree

2 files changed

+9730
-34
lines changed

2 files changed

+9730
-34
lines changed

.github/workflows/npm-publish.yml

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,39 @@
44
name: publish
55

66
on:
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'The tag to publish to: latest | next'
11+
required: false
12+
default: 'latest'
713
release:
814
types: [created]
915

1016
jobs:
11-
build:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v1
16-
with:
17-
node-version: 14
18-
- run: npm ci
19-
- run: npm test
20-
2117
publish-npm:
22-
needs: build
2318
runs-on: ubuntu-latest
2419
steps:
20+
- name: Check Tag Name
21+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != 'latest' && github.event.inputs.tag != 'next' }}
22+
run: |
23+
echo 'Only the tags "latest" or "next" are supported. You entered "${{ github.event.inputs.tag }}"'
24+
exit 1
2525
- uses: actions/checkout@v2
2626
- uses: actions/setup-node@v1
2727
with:
28-
node-version: 14
28+
node-version: '14.x'
2929
registry-url: https://registry.npmjs.org/
30-
- run: npm ci
31-
- run: npm publish
32-
env:
33-
NODE_AUTH_TOKEN: ${{secrets.ADOBE_BOT_NPM_TOKEN}}
34-
35-
publish-gpr:
36-
needs: build
37-
runs-on: ubuntu-latest
38-
steps:
39-
- uses: actions/checkout@v2
40-
- uses: actions/setup-node@v1
30+
- uses: actions/cache@v2
31+
id: npm-cache
32+
with:
33+
path: '**/node_modules'
34+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
35+
- name: Install dependencies
36+
if: steps.npm-cache.outputs.cache-hit != 'true'
37+
run: npm ci
38+
- run: npm test
39+
- uses: JS-DevTools/npm-publish@v1
4140
with:
42-
node-version: 14
43-
registry-url: https://npm.pkg.github.com/
44-
- run: npm ci
45-
- run: npm publish
46-
env:
47-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
41+
token: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
42+
tag: ${{ github.event.inputs.tag || 'latest' }}

0 commit comments

Comments
 (0)