Merge pull request #50 from Centeva/devync/ng-17 #57
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: Publish NPM Package | |
on: | |
push: | |
branches: | |
- "master" | |
jobs: | |
get_semver: | |
name: Create semver | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
outputs: | |
semVer: ${{ steps.gitversion.outputs.semVer }} | |
build_and_publish: | |
name: Build centeva-angular | |
runs-on: ubuntu-latest | |
needs: | |
get_semver | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 20 | |
- name: Version | |
run: | | |
cd ./projects/centeva-core | |
npm version ${{ needs.get_semver.outputs.semVer }} --git-tag-version=false | |
- name: Build | |
run: | | |
npm ci | |
npm run build | |
- name: Publish | |
run: | | |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | |
npm publish --ignore-scripts ./dist/centeva-core --access public | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
create_tag: | |
name: Push github tag | |
runs-on: ubuntu-latest | |
needs: | |
- get_semver | |
- build_and_publish | |
steps: | |
- name: Create tag | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ github.token }} | |
script: | | |
github.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: "refs/tags/${{ needs.get_semver.outputs.semVer }}", | |
sha: context.sha | |
}) |