Skip to content

Commit

Permalink
fix(TU-2623): release to both npm and github registries (#111)
Browse files Browse the repository at this point in the history
BREAKING CHANGES: Break support for Node 16 (end of life 2023-09-11)
due to semantic-release dependency.
  • Loading branch information
mathio authored Dec 6, 2023
1 parent 2d78a4b commit ce4310c
Show file tree
Hide file tree
Showing 5 changed files with 1,678 additions and 69 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
strategy:
matrix:
node_version:
- 16 # end of life 2023-09-11
- 18 # end of life 2025-04-30
- 20 # end of life 2025-04-30
name: build-lint-test - node ${{ matrix.node_version }}
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@ jobs:
- name: Build
run: yarn build

# update registry and tokens with write access for releasing.
- run: rm ./.npmrc
- run: npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN
- run: npm config set '//npm.pkg.github.com/:_authToken' $GH_TOKEN
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Release
if: ${{ contains(github.ref, 'refs/heads/main') || contains(github.ref, 'refs/heads/beta') }}
run: yarn semantic-release
run: yarn release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
30 changes: 30 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
["@semantic-release/commit-analyzer", {
"releaseRules": [
{breaking: true, release: "major"},
{revert: true, release: "patch"},
{type: "feat", release: "minor"},
{type: "fix", release: "patch"},
{type: "perf", release: "patch"},
{type: "chore", scope: "deps", release: "patch"}
],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
}
}],
"@semantic-release/npm",
["@semantic-release/exec", {
"successCmd": "yarn publish:github"
}],
"@semantic-release/github"
]
}
17 changes: 5 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint": "eslint . --max-warnings=0",
"lint-staged": "lint-staged",
"prettier": "prettier --write . --ignore-path .eslintignore",
"semantic-release": "semantic-release",
"release": "npm config set @typeform:registry https://registry.npmjs.org/ && yarn semantic-release",
"server": "node ./tests/integration/mockServer.js",
"server:dev": "nodemon ./tests/integration/mockServer.js",
"publish:github": "npm config set '//npm.pkg.github.com/:_authToken' $GH_TOKEN && npm publish --registry https://npm.pkg.github.com",
Expand Down Expand Up @@ -61,7 +61,10 @@
"devDependencies": {
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@semantic-release/exec": "^5.0.0",
"@semantic-release/commit-analyzer": "^11.1.0",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/github": "^9.2.4",
"@semantic-release/npm": "^11.0.1",
"@typeform/eslint-config": "^6.0.3",
"@types/jest": "^24.0.18",
"axios-mock-adapter": "^1.22.0",
Expand Down Expand Up @@ -106,15 +109,5 @@
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"release": {
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
{
"name": "beta",
"prerelease": true
}
]
}
}
Loading

0 comments on commit ce4310c

Please sign in to comment.