Skip to content

Commit ce4310c

Browse files
authored
fix(TU-2623): release to both npm and github registries (#111)
BREAKING CHANGES: Break support for Node 16 (end of life 2023-09-11) due to semantic-release dependency.
1 parent 2d78a4b commit ce4310c

File tree

5 files changed

+1678
-69
lines changed

5 files changed

+1678
-69
lines changed

.github/workflows/pr.yml

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
strategy:
1212
matrix:
1313
node_version:
14-
- 16 # end of life 2023-09-11
1514
- 18 # end of life 2025-04-30
1615
- 20 # end of life 2025-04-30
1716
name: build-lint-test - node ${{ matrix.node_version }}

.github/workflows/release.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@ jobs:
3535
- name: Build
3636
run: yarn build
3737

38+
# update registry and tokens with write access for releasing.
39+
- run: rm ./.npmrc
40+
- run: npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN
41+
- run: npm config set '//npm.pkg.github.com/:_authToken' $GH_TOKEN
42+
env:
43+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
44+
3845
- name: Release
3946
if: ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/heads/beta') }}
40-
run: yarn semantic-release
47+
run: yarn release
4148
env:
4249
GH_TOKEN: ${{ secrets.GH_TOKEN }}
4350
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.releaserc

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"branches": [
3+
"+([0-9])?(.{+([0-9]),x}).x",
4+
"main",
5+
{
6+
"name": "beta",
7+
"prerelease": true
8+
}
9+
],
10+
"plugins": [
11+
["@semantic-release/commit-analyzer", {
12+
"releaseRules": [
13+
{breaking: true, release: "major"},
14+
{revert: true, release: "patch"},
15+
{type: "feat", release: "minor"},
16+
{type: "fix", release: "patch"},
17+
{type: "perf", release: "patch"},
18+
{type: "chore", scope: "deps", release: "patch"}
19+
],
20+
"parserOpts": {
21+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
22+
}
23+
}],
24+
"@semantic-release/npm",
25+
["@semantic-release/exec", {
26+
"successCmd": "yarn publish:github"
27+
}],
28+
"@semantic-release/github"
29+
]
30+
}

package.json

+5-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lint": "eslint . --max-warnings=0",
1414
"lint-staged": "lint-staged",
1515
"prettier": "prettier --write . --ignore-path .eslintignore",
16-
"semantic-release": "semantic-release",
16+
"release": "npm config set @typeform:registry https://registry.npmjs.org/ && yarn semantic-release",
1717
"server": "node ./tests/integration/mockServer.js",
1818
"server:dev": "nodemon ./tests/integration/mockServer.js",
1919
"publish:github": "npm config set '//npm.pkg.github.com/:_authToken' $GH_TOKEN && npm publish --registry https://npm.pkg.github.com",
@@ -61,7 +61,10 @@
6161
"devDependencies": {
6262
"@commitlint/cli": "^8.1.0",
6363
"@commitlint/config-conventional": "^8.1.0",
64-
"@semantic-release/exec": "^5.0.0",
64+
"@semantic-release/commit-analyzer": "^11.1.0",
65+
"@semantic-release/exec": "^6.0.3",
66+
"@semantic-release/github": "^9.2.4",
67+
"@semantic-release/npm": "^11.0.1",
6568
"@typeform/eslint-config": "^6.0.3",
6669
"@types/jest": "^24.0.18",
6770
"axios-mock-adapter": "^1.22.0",
@@ -106,15 +109,5 @@
106109
"pre-commit": "lint-staged",
107110
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
108111
}
109-
},
110-
"release": {
111-
"branches": [
112-
"+([0-9])?(.{+([0-9]),x}).x",
113-
"main",
114-
{
115-
"name": "beta",
116-
"prerelease": true
117-
}
118-
]
119112
}
120113
}

0 commit comments

Comments
 (0)