Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add publish workflow #5168

Merged
merged 4 commits into from Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
@@ -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
sheremet-va marked this conversation as resolved.
Show resolved Hide resolved
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
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
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
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": "^1.0.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/coverage-v8/package.json
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": "^1.0.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/expect/package.json
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
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
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
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
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": "^1.0.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/package.json
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
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
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
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
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