66
loading...
This website collects cookies to deliver better user experience
dist
directory updated by @vercel/ncc
right after we update its dependencies.@vercel/ncc
before the release automatically.npm add -D semantic-release @semantic-release/exec @semantic-release/git
package.json
, confirm that we have a script to run ncc
to optimize JS files like below:"scripts": {
"package": "ncc build --source-map"
}
semantic-release
.main
branch as default branch, and run exec
plugin and git
plugin:"release": {
"branches": "main",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
["@semantic-release/exec", {
"prepare": "npm run package"
}],
[
"@semantic-release/git",
{
"assets": [
"dist",
"package.json",
"package-lock.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
.github/dependabot.yml
to enable dependabot. Make sure commit-message
part is configured with prefix: fix
to following the Conventional Commits.version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
commit-message:
prefix: fix
prefix-development: chore
include: scope
.github/auto-merge.yml
will be like below:minApprovals:
NONE: 0
requiredLabels:
- dependencies
updateBranch: true
mergeMethod: rebase
NONE: 0
to minApprovals
configuration to merge without manual review, make sure the branch protection rule is created for the default branch, to make sure PRs will be merged only when required status checks have passed.secrets.GITHUB_TOKEN
provides not enough permission so you'll face an error like below:error: GH006: Protected branch update failed for refs/heads/main.
error: 2 of 2 required status checks are expected.
public_repo
scope is enough.- uses: actions/checkout@v2
with:
# Make sure the release step uses its own credentials.
persist-credentials: false
- run: |
npm ci
npm run all
- name: Run semantic-release
# This process will run `ncc`, commit files, push a Git commit, and release to GitHub and npmjs.
run: |
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.PAT_TO_PUSH }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
actions/checkout
with persist-credentials: false
, or git
plugin will use the GitHub token generated by actions/checkout
.GITHUB_TOKEN
when we run npx semantic-release
.dist
directory updated. semantic-release helps us not only by tagging but also by running commands to make the project ready to release.