Skip to content

Commit

Permalink
Merge branch 'main' of github.com:roots/bud into fix-nightly-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kellymears committed Sep 1, 2023
2 parents 21df519 + 4bf13e4 commit 436b6e7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
20 changes: 12 additions & 8 deletions sources/@repo/yarn-plugin-bud/bundles/@yarnpkg/plugin-bud.js

Large diffs are not rendered by default.

26 changes: 17 additions & 9 deletions sources/@repo/yarn-plugin-bud/sources/command/release.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable n/no-process-env */
import {CommandClass, Option} from 'clipanion'
import {noop} from 'lodash'

Expand Down Expand Up @@ -68,14 +67,7 @@ export class Release extends Command {
}

if (!this.version) {
const date = new Date()
const utcSemver = [
date.getUTCFullYear(),
date.getUTCMonth() + 1,
date.getUTCDate(),
].join(`.`)

this.version = `${utcSemver}-${parseInt(`${date.getUTCHours()}`)}${parseInt(`${date.getUTCMinutes()}`)}`
this.version = this.makeVersion()
}

await this.cli
Expand All @@ -99,6 +91,22 @@ export class Release extends Command {
.catch(this.catch)

await this.resetRegistry()

this.context.stdout.write(`\n\n📦 Released: ${this.version}\n\n`)
}

/**
* Get a unique identifier for the build.
*/
public makeVersion(): string {
const date = new Date()
const utc = [
date.getUTCFullYear(),
date.getUTCMonth() + 1,
date.getUTCDate(),
]
const rc = [date.getUTCHours(), date.getUTCMinutes()]
return [utc.join(`.`), parseInt(rc.join(``))].join(`-`)
}

public async resetRegistry() {
Expand Down

0 comments on commit 436b6e7

Please sign in to comment.