Skip to content

Commit 4329ce4

Browse files
committed
fix: handle NPM dist-tags in second release
1 parent ade8e7a commit 4329ce4

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/workflows/build.yml

+13-3
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,18 @@ jobs:
9191
env:
9292
NPM_TOKEN: ${{ secrets.PLAYWRIGHT_TESTING_LIBRARY_TOKEN }}
9393

94-
- name: Upload Coverage / Release / Playwright Test
95-
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' }}
94+
- name: Set branch name
95+
id: branch
96+
run: echo ::set-output name=branch::${GITHUB_REF#refs/*/}
97+
98+
- name: Release / Playwright Test (latest)
99+
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' && steps.branch.outputs.branch == 'main' }}
100+
run: |
101+
npm run prepare:playwright-test
102+
npm publish --access=public
103+
104+
- name: Release / Playwright Test (pre-release)
105+
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' && steps.branch.outputs.branch != 'main' }}
96106
run: |
97107
npm run prepare:playwright-test
98-
npm publish
108+
npm publish --access=public --tag=${{ steps.branch.outputs.branch }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ coverage/
33
.nyc_output/
44
dist/
55
yarn-error.log
6+
.npmrc
67

78
dom-testing-library.js
89
fixture.js

playwright-test/prepare-package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const run = async () => {
1212
name: '@playwright-testing-library/test',
1313
}
1414

15-
await fs.writeFile(PACKAGE, JSON.stringify(modifiedPackage, undefined, 2))
15+
await fs.writeFile(PACKAGE, `${JSON.stringify(modifiedPackage, undefined, 2)}\n`)
1616
}
1717

1818
run()

0 commit comments

Comments
 (0)