react-modular-datepicker 0.0.1 → 0.0.2-canary.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +22 -10
- package/package.json +5 -1
- package/scripts/bump-version.js +41 -0
|
@@ -8,7 +8,6 @@ on:
|
|
|
8
8
|
options:
|
|
9
9
|
- canary
|
|
10
10
|
- stable
|
|
11
|
-
|
|
12
11
|
semverType:
|
|
13
12
|
description: semver type?
|
|
14
13
|
type: choice
|
|
@@ -17,31 +16,44 @@ on:
|
|
|
17
16
|
- minor
|
|
18
17
|
- major
|
|
19
18
|
|
|
20
|
-
secrets:
|
|
21
|
-
RELEASE_BOT_GITHUB_TOKEN:
|
|
22
|
-
required: true
|
|
23
|
-
|
|
24
19
|
name: Release
|
|
25
20
|
|
|
21
|
+
env:
|
|
22
|
+
SEMVER_TYPE: ${{ github.event.inputs.semverType }}
|
|
23
|
+
RELEASE_TYPE: ${{ github.event.inputs.releaseType }}
|
|
24
|
+
|
|
26
25
|
jobs:
|
|
27
|
-
|
|
26
|
+
release:
|
|
28
27
|
runs-on: ubuntu-latest
|
|
29
|
-
|
|
30
28
|
steps:
|
|
31
29
|
- uses: actions/checkout@v4
|
|
32
30
|
- uses: pnpm/action-setup@v3
|
|
33
31
|
with:
|
|
34
32
|
version: 8
|
|
35
|
-
-
|
|
36
|
-
uses: actions/setup-node@v4
|
|
33
|
+
- uses: actions/setup-node@v4
|
|
37
34
|
with:
|
|
38
35
|
node-version: 18
|
|
39
36
|
cache: 'pnpm'
|
|
40
37
|
- name: Install dependencies
|
|
41
38
|
run: pnpm i --frozen-lockfile
|
|
39
|
+
- name: Configure git
|
|
40
|
+
run: |
|
|
41
|
+
git config user.name "dragate"
|
|
42
|
+
git config user.email "spidfair@gmail.com"
|
|
43
|
+
- name: Bump version and tag
|
|
44
|
+
id: bump
|
|
45
|
+
run: node ./scripts/bump-version.js
|
|
46
|
+
- name: Push version commit
|
|
47
|
+
run: |
|
|
48
|
+
git push origin ${GITHUB_REF#refs/heads/}
|
|
49
|
+
git push origin --tags
|
|
50
|
+
- name: Create release
|
|
51
|
+
run: gh release create v${{ steps.bump.outputs.version }} --target ${GITHUB_REF#refs/heads/} --generate-notes ${{ github.event.inputs.releaseType == 'canary' && '--prerelease' || '' }}
|
|
52
|
+
env:
|
|
53
|
+
GH_TOKEN: ${{ github.token }}
|
|
42
54
|
- name: Set publishing config
|
|
43
55
|
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
|
44
56
|
env:
|
|
45
57
|
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
|
|
46
58
|
- name: Publish package
|
|
47
|
-
run: pnpm publish --
|
|
59
|
+
run: pnpm publish --tag ${{ github.event.inputs.releaseType }}
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-modular-datepicker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-canary.4",
|
|
4
4
|
"description": "Another react datepicker",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [],
|
|
7
7
|
"author": "",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"semver": "^7.6.0",
|
|
11
|
+
"typescript": "^5.4.4"
|
|
12
|
+
},
|
|
9
13
|
"scripts": {
|
|
10
14
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
15
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const { execSync } = require('child_process')
|
|
4
|
+
const semver = require('semver')
|
|
5
|
+
|
|
6
|
+
const packageJsonPath = path.join(__dirname, '../package.json')
|
|
7
|
+
const packageJsonData = fs.readFileSync(packageJsonPath, 'utf8')
|
|
8
|
+
const packageJson = JSON.parse(packageJsonData)
|
|
9
|
+
|
|
10
|
+
let version = packageJson.version
|
|
11
|
+
|
|
12
|
+
switch (process.env.RELEASE_TYPE) {
|
|
13
|
+
case "canary":
|
|
14
|
+
version = semver.prerelease(version)
|
|
15
|
+
? semver.inc(version, 'prerelease')
|
|
16
|
+
: semver.inc(version, `pre${process.env.SEMVER_TYPE}`, 'canary')
|
|
17
|
+
break
|
|
18
|
+
case "stable":
|
|
19
|
+
if (!process.env.SEMVER_TYPE) {
|
|
20
|
+
console.error('Missing semver type. Expected "patch", "minor" or "major".')
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
version = semver.inc(version, process.env.SEMVER_TYPE)
|
|
24
|
+
break
|
|
25
|
+
default:
|
|
26
|
+
console.error('Invalid release type. Expected "canary" or "stable".')
|
|
27
|
+
process.exit(1)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
console.log(`::set-output name=version::${version}`);
|
|
31
|
+
|
|
32
|
+
if (process.env.DRY_RUN) {
|
|
33
|
+
console.log(`pnpm version ${version}`)
|
|
34
|
+
} else {
|
|
35
|
+
try {
|
|
36
|
+
execSync(`pnpm version ${version}`, { stdio: 'inherit' })
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Failed to execute version:', error)
|
|
39
|
+
process.exit(1)
|
|
40
|
+
}
|
|
41
|
+
}
|