diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0c017c0..4ed0ef7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,9 @@ name: Publish on: release: types: [published] + workflow_dispatch: + push: + branches: [add-semantic-release] jobs: build: @@ -10,9 +13,16 @@ jobs: 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 @@ -20,7 +30,13 @@ jobs: - 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 diff --git a/package.json b/package.json index fa6c854..ee1f8df 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/release.config.js b/release.config.js new file mode 100644 index 0000000..ec63563 --- /dev/null +++ b/release.config.js @@ -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}", + }, + ], + ], +};