forked from vercel/swr
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (73 loc) · 2.02 KB
/
test-release.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
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
83
name: Test and Release
on:
push:
branches:
- main
tags:
- v*
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install
uses: ./.github/workflows/install
- name: Lint and test
run: |
pnpm clean
pnpm build
pnpm run-all-checks
pnpm attw
pnpm test:build
e2e:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.34.3-focal
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install
uses: ./.github/workflows/install
- name: E2E Tests
run: |
pnpm clean
pnpm build
pnpm build:e2e
pnpm test:e2e
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: playwright-report
release:
runs-on: ubuntu-latest
needs: ["test", "e2e"]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
steps:
- name: Check out
uses: actions/checkout@v3
- name: Install
uses: ./.github/workflows/install
- name: Determine tag
id: determine_tag
run: |
echo "tag=$(echo $GITHUB_REF | grep -Eo 'alpha|beta|canary|rc')" >> $GITHUB_OUTPUT
- name: Publish to versioned tag
if: steps.determine_tag.outputs.tag != ''
run: |
echo "Publishing to ${{ steps.determine_tag.outputs.tag }} tag"
npm publish --access public --no-git-checks --provenance --tag ${{ steps.determine_tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
- name: Publish to latest
if: steps.determine_tag.outputs.tag == ''
run: |
echo "Publishing to latest"
npm publish --access public --no-git-checks --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}