react-modular-datepicker 0.0.1 → 0.0.2-canary.18

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.
@@ -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,45 @@ on:
17
16
  - minor
18
17
  - major
19
18
 
20
- secrets:
21
- RELEASE_BOT_GITHUB_TOKEN:
22
- required: true
19
+ permissions:
20
+ contents: write
21
+ id-token: write
23
22
 
24
23
  name: Release
25
24
 
25
+ env:
26
+ SEMVER_TYPE: ${{ github.event.inputs.semverType }}
27
+ RELEASE_TYPE: ${{ github.event.inputs.releaseType }}
28
+
26
29
  jobs:
27
- start:
30
+ release:
28
31
  runs-on: ubuntu-latest
29
-
30
32
  steps:
31
- - uses: actions/checkout@v4
32
- - uses: pnpm/action-setup@v3
33
+ - uses: actions/checkout@v6
34
+ - uses: pnpm/action-setup@v6
33
35
  with:
34
- version: 8
35
- - name: Setup node
36
- uses: actions/setup-node@v4
36
+ version: 11
37
+ - uses: actions/setup-node@v6
37
38
  with:
38
- node-version: 18
39
+ node-version: 22
39
40
  cache: 'pnpm'
41
+ registry-url: 'https://registry.npmjs.org'
40
42
  - name: Install dependencies
41
43
  run: pnpm i --frozen-lockfile
42
- - name: Set publishing config
43
- run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
44
+ - name: Configure git
45
+ run: |
46
+ git config user.name "dragate"
47
+ git config user.email "spidfair@gmail.com"
48
+ - name: Bump version and tag
49
+ id: bump
50
+ run: node ./scripts/bump-version.js
51
+ - name: Push version commit
52
+ run: |
53
+ git push origin ${GITHUB_REF#refs/heads/}
54
+ git push origin --tags
55
+ - name: Create release
56
+ run: gh release create v${{ steps.bump.outputs.version }} --target ${GITHUB_REF#refs/heads/} --generate-notes ${{ github.event.inputs.releaseType == 'canary' && '--prerelease' || '' }}
44
57
  env:
45
- NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
58
+ GH_TOKEN: ${{ github.token }}
46
59
  - name: Publish package
47
- run: pnpm publish --access public --tag ${{ github.event.inputs.releaseType }}
60
+ run: pnpm publish --no-git-checks --access public --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.1",
3
+ "version": "0.0.2-canary.18",
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.8.1",
11
+ "typescript": "^6.0.3"
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
+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=${version}\n`)
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
+ }