Skip to content

Commit 08a449e

Browse files
authored
Merge pull request #3009 from mjmlio/ci/publish-action
ci(publish action): add publish action MJML-29
2 parents d8212d9 + 6213701 commit 08a449e

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Package to NPM
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
release_type:
6+
description: 'Version bump type'
7+
required: true
8+
default: 'patch'
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
id-token: write
20+
steps:
21+
- uses: actions/checkout@v5
22+
with:
23+
fetch-depth: 0
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: '20.x'
27+
registry-url: 'https://registry.npmjs.org'
28+
- run: yarn install
29+
- run: yarn build
30+
- run: yarn build-browser
31+
- name: Configure git user
32+
run: |
33+
git config user.name "github-actions[bot]"
34+
git config user.email "github-actions[bot]@users.noreply.github.com"
35+
- name: Bump version
36+
id: bump
37+
run: |
38+
yarn lerna version ${{ github.event.inputs.release_type }} --no-push --no-git-tag-version --yes --no-private --force-publish
39+
NEW_VERSION=$(jq -r '.version' lerna.json)
40+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
41+
- name: Commit & tag release
42+
run: |
43+
git add lerna.json packages/*/package.json
44+
git commit -m "chore(release): v${{ steps.bump.outputs.version }}"
45+
git push origin HEAD
46+
- name: Create GitHub Release
47+
uses: softprops/action-gh-release@v2
48+
with:
49+
tag_name: v${{ steps.bump.outputs.version }}
50+
generate_release_notes: true
51+
- name: Publish packages to NPM
52+
run: yarn lerna exec npm publish

0 commit comments

Comments
 (0)