Skip to content

Commit a8979cf

Browse files
committed
Updated github actions.
1 parent df0b484 commit a8979cf

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Manual Publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
description: 'Tagged version to release on NPM'
8+
default: ''
9+
required: false
10+
type: string
11+
12+
jobs:
13+
manual-publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
- name: Update NPM to latest
27+
run: npm install npm@latest -g
28+
29+
- name: Print Node.js and NPM version
30+
run: |
31+
node -v
32+
npm -v
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Build package
38+
run: npm run build
39+
40+
- name: Create .npmrc
41+
run: |
42+
echo "registry=https://registry.npmjs.org/" > .npmrc
43+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" >> .npmrc
44+
45+
- name: NPM whoami
46+
run: npm whoami
47+
48+
- name: Publish package
49+
run: |
50+
if [ "${{ inputs.tag }}" != "" ]; then
51+
npm publish --workspaces --tag $(echo "${{ inputs.tag }}" | sed 's/^v//')
52+
else
53+
npm publish --workspaces
54+
fi

.github/workflows/publish.workflow.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ jobs:
3535

3636
- name: Create .npmrc
3737
run: |
38-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
38+
echo "registry=https://registry.npmjs.org/" > .npmrc
39+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" >> .npmrc
3940
4041
- name: NPM whoami
4142
run: npm whoami
4243

4344
- name: Publish package
44-
run: npm publish --workspaces
45+
run: |
46+
if [[ "${GITHUB_REF#refs/tags/}" =~ "preview" ]]; then
47+
npm publish --workspaces --tag $(echo "${GITHUB_REF#refs/tags/}" | sed 's/^v//')
48+
else
49+
npm publish --workspaces
50+
fi

.github/workflows/test.workflow.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ on:
44
push:
55
branches:
66
- main
7+
paths:
8+
- packages/**
9+
- package-lock.json
10+
- package.json
711
pull_request:
812
types: [opened, synchronize, reopened, ready_for_review]
913
branches:
1014
- main
15+
paths:
16+
- packages/**
17+
- package-lock.json
18+
- package.json
1119

1220
concurrency:
1321
group: ${{ github.workflow }}-${{ github.ref }}

0 commit comments

Comments
 (0)