Skip to content

Commit

Permalink
ci: add semantic-release to publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrc committed Mar 4, 2024
1 parent 2a72e25 commit b33734a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,40 @@ name: Publish
on:
release:
types: [published]
workflow_dispatch:
push:
branches: [add-semantic-release]

jobs:
build:
name: Build and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: Install semantic-release extra plugins
run: npm install --save-dev @semantic-release/changelog @semantic-release/git

- name: Install
run: yarn

- name: Build
run: yarn build

# - name: Publish
# uses: JS-DevTools/npm-publish@v3
# with:
# token: ${{ secrets.CERN_SIS_NPM }}

- name: Publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.CERN_SIS_NPM }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.CERN_SIS_NPM }}
run: npx semantic-release
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/cern-sis/react-formule.git"
"url": "git@github.com:miguelgrc/react-formule.git"
},
"type": "module",
"files": [
Expand Down
17 changes: 17 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
branches: ["add-semantic-release"],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",

[
"@semantic-release/git",
{
assets: ["package.json", "CHANGELOG.md"],
message:
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
},
],
],
};

0 comments on commit b33734a

Please sign in to comment.