Skip to content

fix(TU-2623): release to both npm and github registries #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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