Skip to content

Commit

Permalink
update ci for auto bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
zieka committed Nov 4, 2024
1 parent cc78407 commit 9541aa0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,26 @@ jobs:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Update package.json version from tag
working-directory: openrewrite
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "Release tag is $TAG_VERSION"
npm version $TAG_VERSION --no-git-tag-version
- name: Commit version updates
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add package.json package-lock.json
git commit -m "bump version ${GITHUB_REF#refs/tags/}"
git push origin HEAD:main
- name: publish-npm
working-directory: openrewrite
run: |
npm i
npm run build
npm ci
npm run build
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@ We appreciate all types of contributions. See the [contributing guide](https://g

The release process is done by pushing a Git tag in a format `vX.Y.Z` where XYZ stands for version number we release
and is picked up by Openrewrite Release Plugin.
It is important to a manual bump version in `openrewrite/package.json` after the release since we don't have any plugins
for NPM, which takes a version from the Git tag

```bash
git tag v1.0.0
git push origin v1.0.0
```

After pushing the tag, the CI/CD pipeline will automatically build and publish the package to the npm registry and bump the version in the package.json and package-lock.

0 comments on commit 9541aa0

Please sign in to comment.