Skip to content
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

feat(#9362): publish cht-deploy to npm on version change #9363

Closed
wants to merge 13 commits into from
36 changes: 36 additions & 0 deletions .github/workflows/npm-publish-cht-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish cht-deploy to npm

on:
push:
paths:
- 'scripts/deploy/**'

jobs:
publish-cht-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./scripts/deploy

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: Install dependencies
run: npm ci

- name: Run tests
if: github.ref != 'refs/heads/master'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we merge this check should be at the top level instead of here because the entire publish job should not run if not on master, right?

run: npx mocha --no-config 'tests/*.js'

- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release --config ./scripts/deploy/.releaserc.json
24 changes: 24 additions & 0 deletions scripts/deploy/.releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"branches": [
"master",
{
"name": "*",
"prerelease": "${name}"
}
],
"plugins": [
"@semantic-release/commit-analyzer",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this won't work as expected because it'll get the changelog for all commits on the master branch, not just commits that impact this directory. What do you think?

"@semantic-release/release-notes-generator",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
["@semantic-release/npm", {
"npmPublish": true
}],
"@semantic-release/github",
["@semantic-release/git", {
"assets": ["package.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}]
]
}
Loading
Loading