Skip to content

Commit 26ebac6

Browse files
authored
Merge pull request #22 from idesigncode/configuration
Use "workflow env var" pattern for secrets as env vars
2 parents d592859 + 029957e commit 26ebac6

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

.github/workflows/node.js.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
branches: ['main']
1010

11+
env:
12+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
13+
1114
jobs:
1215
build:
1316
runs-on: ubuntu-latest
@@ -24,5 +27,3 @@ jobs:
2427
with:
2528
node-version: ${{ matrix.node-version }}
2629
- run: npm install-test
27-
env:
28-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/npm-publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
release:
88
types: [created]
99

10+
env:
11+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
13+
1014
jobs:
1115
build:
1216
runs-on: ubuntu-latest
@@ -16,8 +20,6 @@ jobs:
1620
with:
1721
node-version: 20
1822
- run: npm install-test
19-
env:
20-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2123

2224
publish-npm:
2325
needs: build
@@ -30,5 +32,3 @@ jobs:
3032
registry-url: https://registry.npmjs.org/
3133
- run: npm install
3234
- run: npm publish
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/storybook-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
pull_request:
1111
branches: ['main']
1212

13+
env:
14+
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
15+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
16+
1317
jobs:
1418
test:
1519
runs-on: ubuntu-latest
@@ -22,16 +26,12 @@ jobs:
2226
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2327
- name: Install dependencies
2428
run: npm install
25-
env:
26-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2729

2830
- name: Wait for Netlify
2931
uses: probablyup/[email protected]
3032
id: waitForDeployment
3133
with:
3234
site_id: ${{ secrets.NETLIFY_SITE_ID }}
33-
env:
34-
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
3535

3636
- name: Run Storybook tests
3737
run: npm run test:storybook

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The GitHub action [npm-publish.yml](.github/workflows/npm-publish.yml) is used t
4646

4747
#### Code linting tests
4848

49-
The GitHub action [node.js.yml](.github/workflows/node.js.yml) is used to run the code linting tests on pull requests and commit pushes into the main branch.
49+
The GitHub action [node.js.yml](.github/workflows/node.js.yml) is used to run the code linting tests on pull requests and commit pushes into the main branch. The action requires the `NPM_TOKEN` secrets to be set.
5050

5151
`npm run test` runs the code linting tests:
5252

@@ -59,6 +59,7 @@ The GitHub action [storybook-tests.yml](.github/workflows/storybook-tests.yml) i
5959

6060
- `NETLIFY_SITE_ID`
6161
- `NETLIFY_TOKEN`
62+
- `NPM_TOKEN`
6263

6364
These Storybook CI tests can also be run while running Storybook locally:
6465

0 commit comments

Comments
 (0)