Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 0811133

Browse files
committed
fix: re-setup Node for second release and run second release conditionally
1 parent 4b0993f commit 0811133

File tree

4 files changed

+44
-11
lines changed

4 files changed

+44
-11
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ jobs:
4040
uses: actions/setup-node@master
4141
with:
4242
node-version: ${{ matrix.node }}
43-
env:
44-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4543

4644
- name: Update to npm 7
4745
run: npm i -g npm@7 --registry=https://registry.npmjs.org
@@ -76,11 +74,20 @@ jobs:
7674
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7775
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7876

77+
- name: Set flag as to whether we released
78+
id: did-release
79+
run: echo "::set-output name=released::$(node ./playwright-test/check-package.js)"
80+
81+
- name: Setup node for second publish
82+
uses: actions/setup-node@master
83+
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' }}
84+
with:
85+
node-version: ${{ matrix.node }}
86+
env:
87+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
88+
7989
- name: Upload Coverage / Release / Playwright Test
90+
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' }}
8091
run: |
8192
npm run prepare:playwright-test
8293
npm publish
83-
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' }}
84-
env:
85-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
86-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

playwright-test/check-package.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env node
2+
/* eslint-disable no-console */
3+
4+
const fs = require('fs/promises')
5+
const path = require('path')
6+
const process = require('process')
7+
8+
const PACKAGE = path.join(__dirname, '..', 'package.json')
9+
10+
const run = async () => {
11+
const package = JSON.parse(await fs.readFile(PACKAGE, {encoding: 'utf-8'}))
12+
13+
process.stdout.write(JSON.stringify(package.version !== '0.0.0-semantically-released'))
14+
}
15+
16+
run()
17+
.then(() => process.exit(0))
18+
.catch(error => {
19+
console.error(error)
20+
process.exit(1)
21+
})

playwright-test/package.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const fs = require('fs/promises')
2+
const path = require('path')
3+
4+
const PACKAGE = path.join(__dirname, '..', 'package.json')
5+
6+
const getPackage = async () => JSON.parse(await fs.readFile(PACKAGE, {encoding: 'utf-8'}))
7+
8+
module.exports = {PACKAGE, getPackage}

playwright-test/prepare-package.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
/* eslint-disable no-console */
33

44
const fs = require('fs/promises')
5-
const path = require('path')
65

7-
const PACKAGE = path.join(__dirname, '..', 'package.json')
6+
const {PACKAGE, getPackage} = require('./package')
87

98
const run = async () => {
10-
const package = JSON.parse(await fs.readFile(PACKAGE, {encoding: 'utf-8'}))
11-
129
const modifiedPackage = {
13-
...package,
10+
...getPackage(),
1411
name: '@playwright-testing-library/test',
1512
}
1613

0 commit comments

Comments
 (0)