-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: pnpm | ||
- run: pnpm install | ||
|
||
test: | ||
needs: install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: pnpm | ||
- run: pnpm install | ||
|
||
- name: Lint | ||
run: pnpm run lint | ||
|
||
check-workflow-files: | ||
needs: install | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker://rhysd/actionlint:1.6.26 | ||
with: | ||
args: -color | ||
|
||
build: | ||
needs: [test, check-workflow-files] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v2 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: pnpm | ||
- run: pnpm install | ||
- run: pnpm run build | ||
|
||
publish: | ||
if: ${{ always() && !failure() && !cancelled() }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- uses: pnpm/action-setup@v2 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: pnpm | ||
- run: pnpm install | ||
|
||
- name: Publish (development) | ||
if: github.event.pull_request.head.repo.full_name == 'RightCapitalHQ/verdaccio-package-diff' && github.base_ref == github.event.repository.default_branch | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
HEAD_REF: ${{ github.head_ref }} | ||
run: | | ||
npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}" | ||
preid="${HEAD_REF//\//-}".${{ github.run_number }}.${{ github.run_attempt }} | ||
pnpm exec npm --no-git-tag-version version prerelease --preid="${preid}" | ||
pnpm publish --no-git-checks --access public --tag development | ||
- name: Publish (main) | ||
if: github.repository == 'RightCapitalHQ/verdaccio-package-diff' && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
run: | | ||
npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}" | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions[bot]" | ||
git remote set-url origin "https://${{ secrets.REPO_AUTOMATION_TOKEN }}@github.com/${{ github.repository }}.git" | ||
pnpm beachball publish --yes -m 'chore(release): applying package updates' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
comments: | ||
require-starting-space: false | ||
min-spaces-from-content: 1 | ||
document-start: | ||
present: false | ||
line-length: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import type { BeachballConfig } from 'beachball'; | ||
|
||
const config: BeachballConfig = { | ||
access: 'public', | ||
registry: 'https://registry.npmjs.org', | ||
ignorePatterns: [ | ||
'.*ignore', | ||
'.yamllint', | ||
'.eslintrc.cjs', | ||
'.pnpm-store/**', | ||
'.vscode/**', | ||
'prettier.config.cjs', | ||
'pnpm-lock.yaml', | ||
], | ||
changelog: { | ||
customRenderers: { | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async renderChangeTypeHeader(changeType, renderInfo) { | ||
const changelogDate = renderInfo.newVersionChangelog.date | ||
.toLocaleDateString('zh-CN') | ||
.replace(/\//g, '-'); | ||
const heading = | ||
changeType === 'major' || changeType === 'minor' ? '##' : '###'; | ||
return `${heading} [${ | ||
renderInfo.newVersionChangelog.version | ||
}](https://github.com/RightCapitalHQ/verdaccio-package-diff/tree/${encodeURIComponent( | ||
renderInfo.newVersionChangelog.tag, | ||
)}) (${changelogDate})`; | ||
}, | ||
// Original template: https://github.com/microsoft/beachball/blob/aefbc1ac37ee85961cc787133c827f1fd3925550/src/changelog/renderPackageChangelog.ts#L93 | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
async renderEntry(entry) { | ||
if (entry.author === 'beachball') { | ||
return `- ${entry.comment}`; | ||
} | ||
// Imitate GitHub's commit format https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls#commit-shas | ||
return `- ${entry.comment} ([${entry.commit.substring( | ||
0, | ||
7, | ||
)}](https://github.com/RightCapitalHQ/verdaccio-package-diff/commit/${ | ||
entry.commit | ||
}))`; | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.