Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 6384d9c

Browse files
Bendertrue
Bender
authored and
true
committed
fix(ci): use just master for publishing
1 parent f39b8d3 commit 6384d9c

File tree

5 files changed

+23
-44
lines changed

5 files changed

+23
-44
lines changed

Diff for: .github/workflows/pr-check.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Check PR for word'
1+
name: Check PR
22
on: [pull_request]
33

44
jobs:
@@ -16,9 +16,4 @@ jobs:
1616
cache: 'npm'
1717
- name: Install dependencies
1818
run: npm ci
19-
- uses: kceb/pull-request-url-action@v1
20-
id: pr-url
21-
- name: Validate SemVer
22-
run: npx auto pr-check --url ${{ steps.pr-url.outputs.url }}
23-
env:
24-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
# TODO: Use CLI guess.

Diff for: .github/workflows/publish.yml

-29
This file was deleted.

Diff for: .github/workflows/version.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: Bump version and fork a release branch
12
on:
23
push:
34
branches: ['master']
@@ -22,8 +23,11 @@ jobs:
2223
- name: Install dependencies
2324
run: npm ci
2425
- name: Build CLI
25-
run: npm run build:main
26+
run: npm run build
2627
- name: Release
2728
run: npm run release --gitUser @sladg --gitEmail [email protected]
2829
env:
2930
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- uses: JS-DevTools/npm-publish@v1
32+
with:
33+
token: ${{ secrets.NPM_TOKEN }}

Diff for: lib/cli.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ program
174174
.action(async (options) => {
175175
const { tagPrefix, failOnMissingCommit, releaseBranchPrefix, forceBump, gitUser, gitEmail } = options
176176

177+
console.log('Our config is: ', options)
178+
177179
const git = simpleGit()
178180

179181
git.addConfig('user.name', gitUser)
@@ -188,6 +190,8 @@ program
188190
const latestTag = tags.latest ?? '0.0.0'
189191
const currentTag = latestTag.replace(tagPrefix, '')
190192

193+
console.log('Current version: ', latestTag)
194+
191195
if (!isValidTag(latestTag, tagPrefix)) {
192196
throw new Error(`Invalid tag found - ${latestTag}!`)
193197
}
@@ -205,7 +209,7 @@ program
205209
throw new Error('No new commits since last tag.')
206210
}
207211

208-
const bumps = []
212+
const bumps: BumpType[] = []
209213

210214
commits.all.forEach(({ message, body }) => {
211215
const match = bumpMapping.find(({ test, scanBody }) => (scanBody ? body : message).match(test))
@@ -216,8 +220,11 @@ program
216220
}
217221
})
218222

223+
console.log('Bumps: ', bumps)
224+
219225
// Bump minor in case nothing is found.
220226
if (bumps.length < 1 && forceBump) {
227+
console.log('Forcing patch bump!')
221228
bumps.push(BumpType.Patch)
222229
}
223230

@@ -226,6 +233,10 @@ program
226233
const releaseBranch = `${releaseBranchPrefix}${nextTagWithPrefix}`
227234
console.log(`Next version is - ${nextTagWithPrefix}!`)
228235

236+
if (currentTag === nextTag) {
237+
throw new Error('Failed to bump version!')
238+
}
239+
229240
const replacementResults = replaceVersionInCommonFiles(currentTag, nextTag)
230241
console.log(`Replaced version in files.`, replacementResults)
231242

@@ -236,7 +247,9 @@ program
236247
.raw('commit', '--message', `"Release: ${nextTagWithPrefix} ${skipCiFlag}"`)
237248
// Create tag and push it to master.
238249
.addTag(nextTagWithPrefix)
239-
.push(remote.name, branch.current)
250+
251+
git.push(remote.name, branch.current)
252+
git.pushTags()
240253

241254
// As current branch commit includes skip ci flag, we want to ommit this flag for release branch so pipeline can run (omitting infinite loop).
242255
// So we are overwriting last commit message and pushing to release branch.

Diff for: package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,5 @@
5757
"engines": {
5858
"node": ">=16"
5959
},
60-
"engineStrict": true,
61-
"publishConfig": {
62-
"access": "public",
63-
"registry": "https://registry.npmjs.org/"
64-
}
60+
"engineStrict": true
6561
}

0 commit comments

Comments
 (0)