Skip to content

Commit 256f916

Browse files
authored
build: Setup npm release flow (#33)
Add in release npm flow for the bundler plugins.
1 parent 2c1c77a commit 256f916

File tree

15 files changed

+751
-13
lines changed

15 files changed

+751
-13
lines changed

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/sweet-lemons-add.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@codecov/bundler-plugin-core": major
3+
"@codecov/webpack-plugin": major
4+
"@codecov/rollup-plugin": major
5+
"@codecov/vite-plugin": major
6+
---
7+
8+
Initial release of the Codecov JavaScript Bundler Plugins

.github/workflows/prepare-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Prepare Publish
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency: ${{ github.workflow }}-${{ github.ref }}
7+
8+
jobs:
9+
publish:
10+
name: Prepare Publish
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Node
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version-file: "package.json"
20+
21+
- name: Setup pnpm & install dependencies
22+
uses: pnpm/action-setup@v2
23+
with:
24+
run_install: true
25+
26+
- name: Create Release Pull Request
27+
id: changesets
28+
uses: changesets/action@v1
29+
with:
30+
version: pnpm run changeset:consume
31+
commit: "meta(changelog): Update package versions"
32+
title: "meta(changelog): Update package versions"
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "**/CHANGELOG.md"
9+
10+
concurrency: ${{ github.workflow }}-${{ github.ref }}
11+
12+
jobs:
13+
publish:
14+
name: Publish
15+
runs-on: ubuntu-latest
16+
# For whatever reason, yaml does not like the full "meta(changelog): Update package versions" string
17+
# So we check this in two parts
18+
if: |
19+
contains(github.event.head_commit.message, 'meta(changelog)')
20+
&& contains(github.event.head_commit.message, 'Update package versions')
21+
steps:
22+
- name: Checkout Repo
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version-file: "package.json"
29+
30+
- name: Setup pnpm & install dependencies
31+
uses: pnpm/action-setup@v2
32+
with:
33+
run_install: true
34+
35+
- name: Publish to NPM
36+
uses: changesets/action@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40+
with:
41+
publish: pnpm changeset:publish
42+
createGithubReleases: true

examples/next-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "next-js-test",
2+
"name": "@codecov/nextjs-plugin-example",
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {

examples/rollup/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "rollup-test",
2+
"name": "@codecov/rollup-plugin-example",
33
"version": "1.0.0",
44
"main": "index.js",
55
"scripts": {

examples/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "vite-test",
2+
"name": "@codecov/vite-plugin-example",
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",

examples/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "webpack-test",
2+
"name": "@codecov/webpack-plugin-example",
33
"version": "0.0.0",
44
"private": "true",
55
"scripts": {

integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "integration-tests",
2+
"name": "@codecov/plugin-integration-tests",
33
"version": "1.0.0",
44
"description": "",
55
"private": true,

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"description": "Codecov Bundler Plugins Monorepo",
55
"private": true,
66
"workspaces": [
7-
"packages/*",
8-
"integration-tests"
7+
"packages/*"
98
],
109
"scripts": {
1110
"build": "pnpm -r --filter='./packages/*' run build",
@@ -19,9 +18,13 @@
1918
"test:unit": "pnpm -r --filter='./packages/*' run test:unit",
2019
"test:unit:ci": "pnpm -r --filter='./packages/*' run test:unit:ci",
2120
"test:e2e": "pnpm -r --filter='./integration-tests' run test:e2e",
22-
"prepare": "husky install"
21+
"prepare": "husky install",
22+
"changeset:add": "pnpm changeset",
23+
"changeset:consume": "pnpm changeset version",
24+
"changeset:publish": "pnpm changeset publish"
2325
},
2426
"devDependencies": {
27+
"@changesets/cli": "^2.27.1",
2528
"@total-typescript/ts-reset": "^0.5.1",
2629
"@types/eslint": "^8.44.7",
2730
"@types/node": "^20.10.0",

0 commit comments

Comments
 (0)