Skip to content

Commit

Permalink
Merge branch 'create-npm-package' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanindra-tw authored Apr 16, 2024
2 parents 81438d5 + 524625c commit 1e338f2
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/build_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Release
on:
push:
branches:
- master
- create-npm-package
workflow_dispatch:
jobs:
build-release:
Expand Down Expand Up @@ -39,6 +39,25 @@ jobs:
script: |
core.setFailed('No version change detected. You should run `yarn bump:<patch|minor|major>` to bump the version')
- name: Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
yarn publish --new-version ${{ steps.versionCheck.outputs.version }}
- id: versionCheck
uses: EndBug/version-check@v2
with:
file-url: https://unpkg.com/person-management-app@latest/package.json
static-checking: localIsNew

- name: Version guard
if: steps.versionCheck.outputs.changed == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('No version change detected. You should run `yarn bump:<patch|minor|major>` to bump the version')
- name: Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -57,4 +76,4 @@ jobs:
repo: context.repo.repo,
ref: 'refs/tags/v' + process.env.VERSION,
sha: context.sha
})
})

0 comments on commit 1e338f2

Please sign in to comment.