ci: add release tag (#254)

This commit is contained in:
Kevin Deng 三咲智子 2024-06-23 18:50:36 +08:00 committed by GitHub
parent 4be49b2620
commit 5eb43b08b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -88,7 +88,7 @@ jobs:
- run: pnpm install - run: pnpm install
- run: pnpm release --vapor --skip-tests - run: pnpm release --vapor --skip-tests --tag ${{ github.ref == 'refs/heads/main' && 'latest' || 'branch' }}
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: 'true' NPM_CONFIG_PROVENANCE: 'true'

View File

@ -140,21 +140,21 @@ async function main() {
const major = semver.major(currentVersion) const major = semver.major(currentVersion)
let newVersion let newVersion
if (isCanary) { // The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor)
// The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor) // Use UTC date so that it's consistent across CI and maintainers' machines
// Use UTC date so that it's consistent across CI and maintainers' machines const date = new Date()
const date = new Date() const yyyy = date.getUTCFullYear()
const yyyy = date.getUTCFullYear() const MM = (date.getUTCMonth() + 1).toString().padStart(2, '0')
const MM = (date.getUTCMonth() + 1).toString().padStart(2, '0') const dd = date.getUTCDate().toString().padStart(2, '0')
const dd = date.getUTCDate().toString().padStart(2, '0') const datestamp = `${yyyy}${MM}${dd}`
const datestamp = `${yyyy}${MM}${dd}` if (isCanary) {
newVersion = `${major}.${datestamp}.0` newVersion = `${major}.${datestamp}.0`
if (args.tag && args.tag !== 'latest') { if (args.tag && args.tag !== 'latest') {
newVersion = `${major}.${datestamp}.0-${args.tag}.0` newVersion = `${major}.${datestamp}.0-${args.tag}.0`
} }
} else { } else {
newVersion = `${major}.2024.0-${await getSha(true)}` newVersion = `${major}.${datestamp}.0-${await getSha(true)}`
} }
// check the registry to avoid version collision // check the registry to avoid version collision