Skip to content

Merge pull request #339 from ndustrialio/fix/version-change-after-dep… #284

Merge pull request #339 from ndustrialio/fix/version-change-after-dep…

Merge pull request #339 from ndustrialio/fix/version-change-after-dep… #284

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm install
- name: Run lint
run: npm run lint
- name: Run tests
run: npm run test
release:
needs: tests
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.NIO_BOT_TOKEN }}
- uses: actions/setup-node@v2
with:
node-version-file: .nvmrc
cache: npm
- name: Install dependencies
run: npm install
- name: Bump version
uses: TriPSs/conventional-changelog-action@v3
id: version
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-user-name: 'GitHub Actions'
git-user-email: '[email protected]'
version-file: package.json,package-lock.json
preset: conventionalcommits
output-file: false
- name: Set new commit hash
run: echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Create release
uses: actions/create-release@v1
if: steps.version.outputs.skipped == 'false'
env:
GITHUB_TOKEN: ${{ secrets.NIO_BOT_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
release_name: ${{ steps.version.outputs.tag }}
body: ${{ steps.version.outputs.clean_changelog }}
commitish: ${{ env.SHA }}
- name: Publish to NPM
if: steps.version.outputs.skipped == 'false'
env:
NPM_TOKEN: ${{ secrets.NIO_NPM_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken '${NPM_TOKEN}'
npm publish