-
-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (51 loc) · 1.48 KB
/
build-and-test.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
name: Build and Test
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-latest
env:
MOZ_HEADLESS: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "15"
- uses: pnpm/[email protected]
with:
version: 5.17.3
- run: pnpm install --frozen-lockfile
- run: pnpm test
publish:
runs-on: ubuntu-latest
env:
# used by 'release-it'
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PUBLISH_BOT }}
# used manually in setting git config
BOT_EMAIL: ${{ secrets.PUBLISH_BOT_EMAIL }}
# used by unit tests
MOZ_HEADLESS: 1
needs: build
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
# Use our own token instead of the default token
# this step persists login credentials so strongly that we couldn't get them to override
token: ${{ secrets.PUBLISH_BOT }}
- uses: actions/setup-node@v4
with:
node-version: "15"
- uses: pnpm/[email protected]
with:
version: 5.17.3
- run: pnpm install --frozen-lockfile
- name: Setup auth
run: |
git config --global user.email "$BOT_EMAIL"
git config --global user.name "esm-bundle-org-bot"
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: "Publish to npm"
run: pnpm run release