Skip to content

Commit 35dec8b

Browse files
committed
workflow: set up automated publishing with provenance support
1 parent 8486aa0 commit 35dec8b

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

Diff for: .github/MAINTENANCE.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
This document explains how to perform the project's maintenance tasks.
2+
3+
### Creating a new release
4+
5+
Anyone with write access to the main branch of both this repository and [create-vue-templates](https://github.com/vuejs/create-vue-templates/) can request a new release. This includes repository maintainers, repository adminstrators, and Vue.js organization administrators.
6+
7+
To do so, follow these steps:
8+
9+
1. Run `pnpm version <patch|minor|major>` locally to bump the version number and create a new commit / tag. The `postversion` script will automatically push the changes to the repository.
10+
2. The release will be automatically published to npm by GitHub Actions once approved by an *administrator*.
11+
3. Go to <https://github.com/vuejs/create-vue/releases/new> and create a new release with the tag that was just created. Describe the notable changes in the release notes.

Diff for: .github/workflows/publish.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
release:
10+
# Use Publish environment for deployment protection
11+
environment: Publish
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: pnpm/action-setup@v3
19+
with:
20+
version: 9
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 'lts/*'
24+
registry-url: 'https://registry.npmjs.org'
25+
- run: pnpm install
26+
- run: pnpm publish
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Diff for: package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"pretest": "pnpm run build && pnpm run snapshot",
2424
"test": "zx ./scripts/test.mjs",
2525
"test:unit": "vitest",
26-
"prepublishOnly": "zx ./scripts/prepublish.mjs"
26+
"postversion": "zx ./scripts/postversion.mjs",
27+
"prepublishOnly": "pnpm run build"
2728
},
2829
"repository": {
2930
"type": "git",
@@ -58,5 +59,9 @@
5859
"*.{js,ts,vue,json}": [
5960
"prettier --write"
6061
]
62+
},
63+
"publishConfig": {
64+
"access": "public",
65+
"provenance": true
6166
}
6267
}
File renamed without changes.

0 commit comments

Comments
 (0)