Release new version #545
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release new version | |
on: workflow_dispatch | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: ".nvmrc" | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: npm ci | |
- name: Set up git credentials | |
run: | | |
git config --global user.name 'ci' | |
git config --global user.email '[email protected]' | |
- name: Prepare changes | |
run: npm run release | |
env: | |
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set package version variable | |
run: echo "package_version=$(node -e "console.log(require('./package.json').version)")" >> "$GITHUB_ENV" | |
- name: Commit and push changes | |
run: | | |
git add . | |
git commit -m "Release version ${{ env.package_version }}" | |
git push --follow-tags | |
- name: Publish the new version to npm | |
run: | # Compare the latest version and the current version and publish only if the version changed | |
if [ $(npm view monday-ui-react-core version) != ${{ env.package_version }} ]; then npm run build && npm publish; else echo ''; fi; | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
automatic_release_tag: latest |