Skip to content

Commit

Permalink
ci: add publish workflow (#5168)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Feb 16, 2024
1 parent 6588922 commit 2ee2317
Show file tree
Hide file tree
Showing 18 changed files with 229 additions and 52 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Package

on:
push:
tags:
- 'v*'

permissions:
contents: read
id-token: write

jobs:
publish:
if: github.repository == 'vitest-dev/vitest'
runs-on: ubuntu-latest
environment: Release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node version to 18
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: pnpm

- name: Install
run: pnpm install --frozen-lockfile --prefer-offline
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'

- name: Build
run: pnpm build

- name: Publish to npm
run: pnpm run publish-ci {{ github.ref_name }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Generate Changelog
run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 0 additions & 25 deletions .github/workflows/release.yml

This file was deleted.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"docs:contributors": "tsx scripts/update-contributors.ts",
"lint": "eslint --cache .",
"lint:fix": "nr lint --fix",
"release": "bumpp package.json packages/*/package.json --commit --push --tag && git update-ref refs/heads/release refs/heads/main && git push origin release && pnpm -r publish --access public",
"release:beta": "bumpp package.json packages/*/package.json --commit --push --tag && git update-ref refs/heads/release refs/heads/main && git push origin release && pnpm -r publish --access public --tag beta",
"publish-ci": "tsx scripts/publish-ci.ts",
"release": "bumpp package.json packages/*/package.json --commit --push --tag && git update-ref refs/heads/release refs/heads/main && git push origin release",
"test": "vitest --api -r test/core",
"test:run": "vitest run -r test/core",
"test:all": "CI=true pnpm -r --stream run test --allowOnly",
Expand Down Expand Up @@ -65,7 +65,8 @@
"tsx": "^4.6.1",
"typescript": "^5.2.2",
"vite": "^5.0.12",
"vitest": "workspace:*"
"vitest": "workspace:*",
"zx": "^7.2.3"
},
"pnpm": {
"overrides": {
Expand Down
3 changes: 1 addition & 2 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"build:node": "rollup -c",
"dev:client": "vite build src/client --watch",
"dev:node": "rollup -c --watch --watch.include 'src/node/**'",
"dev": "rimraf dist && pnpm run --stream '/^dev:/'",
"prepublishOnly": "pnpm build"
"dev": "rimraf dist && pnpm run --stream '/^dev:/'"
},
"peerDependencies": {
"playwright": "*",
Expand Down
3 changes: 1 addition & 2 deletions packages/coverage-istanbul/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
],
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch --watch.include 'src/**'",
"prepublishOnly": "pnpm build"
"dev": "rollup -c --watch --watch.include 'src/**'"
},
"peerDependencies": {
"vitest": "workspace:*"
Expand Down
3 changes: 1 addition & 2 deletions packages/coverage-v8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
],
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch --watch.include 'src/**'",
"prepublishOnly": "pnpm build"
"dev": "rollup -c --watch --watch.include 'src/**'"
},
"peerDependencies": {
"vitest": "workspace:*"
Expand Down
3 changes: 1 addition & 2 deletions packages/expect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
],
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch",
"prepublishOnly": "pnpm build"
"dev": "rollup -c --watch"
},
"dependencies": {
"@vitest/spy": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
],
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch",
"prepublishOnly": "pnpm build"
"dev": "rollup -c --watch"
},
"dependencies": {
"@vitest/utils": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/snapshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
],
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch",
"prepublishOnly": "pnpm build"
"dev": "rollup -c --watch"
},
"dependencies": {
"magic-string": "^0.30.5",
Expand Down
3 changes: 1 addition & 2 deletions packages/spy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
],
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch",
"prepublishOnly": "pnpm build"
"dev": "rollup -c --watch"
},
"dependencies": {
"tinyspy": "^2.2.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"dev": "rollup -c --watch --watch.include 'node/**'",
"dev:ui": "pnpm run --stream '/^(dev|dev:client)$/'",
"test:run": "cypress run --component",
"test:open": "cypress open --component",
"prepublishOnly": "pnpm build"
"test:open": "cypress open --component"
},
"peerDependencies": {
"vitest": "workspace:*"
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
],
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch",
"prepublishOnly": "pnpm build"
"dev": "rollup -c --watch"
},
"dependencies": {
"diff-sequences": "^29.6.3",
Expand Down
1 change: 0 additions & 1 deletion packages/vite-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch --watch.include 'src/**' -m inline",
"prepublishOnly": "pnpm build",
"typecheck": "tsc --noEmit"
},
"dependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@
},
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" rollup -c --watch -m inline",
"prepublishOnly": "pnpm build"
"dev": "NODE_OPTIONS=\"--max-old-space-size=8192\" rollup -c --watch -m inline"
},
"peerDependencies": {
"@edge-runtime/vm": "*",
Expand Down
1 change: 0 additions & 1 deletion packages/web-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch --watch.include 'src/**'",
"prepublishOnly": "pnpm build",
"typecheck": "tsc --noEmit"
},
"peerDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/ws-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"scripts": {
"build": "rimraf dist && rollup -c",
"dev": "rollup -c --watch --watch.include 'src/**'",
"prepublishOnly": "pnpm build",
"typecheck": "tsc --noEmit"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 2ee2317

Please sign in to comment.