-
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow: separate version bumping and publishing on release (#6879)
- Loading branch information
Showing
8 changed files
with
359 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Publish Package | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
- "plugin-*" # Push events to matching plugin-*, i.e. plugin-(vue|vue-jsx|react|legacy)@1.0.0 | ||
- "create-vite*" # # Push events to matching create-vite*, i.e. [email protected] | ||
|
||
jobs: | ||
publish: | ||
# prevents this action from running on forks | ||
if: github.repository == 'vitejs/vite' | ||
runs-on: ubuntu-latest | ||
environment: Release | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 6 | ||
|
||
- name: Set node version to 16.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16.x | ||
cache: "pnpm" | ||
|
||
- name: Install deps | ||
run: pnpm install | ||
|
||
- name: Publish package | ||
run: pnpm run ci-publish -- ${{ github.ref_name }} --dry | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { args, getPackageInfo, publishPackage, step } from './releaseUtils' | ||
|
||
async function main() { | ||
const tag = args._[0] | ||
|
||
if (!tag) { | ||
throw new Error('No tag specified') | ||
} | ||
|
||
let pkgName = 'vite' | ||
let version | ||
|
||
if (tag.includes('@')) [pkgName, version] = tag.split('@') | ||
else version = tag | ||
|
||
if (version.startsWith('v')) version = version.slice(1) | ||
|
||
const { currentVersion, pkgDir } = getPackageInfo(pkgName) | ||
if (currentVersion !== version) | ||
throw new Error( | ||
`Package version from tag "${version}" mismatches with current version "${currentVersion}"` | ||
) | ||
|
||
step('Publishing package...') | ||
await publishPackage(pkgDir, version.includes('beta') ? 'beta' : undefined) | ||
} | ||
|
||
main().catch((err) => { | ||
console.error(err) | ||
process.exit(1) | ||
}) |
Oops, something went wrong.