Merge pull request #5 from ponlawat-w/dev/ol-10.2.1 #10
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 | |
on: | |
push: | |
branches: master | |
jobs: | |
unit-tests: | |
name: Unit Tests | |
uses: ./.github/workflows/unit-tests.yml | |
publish: | |
name: Publish | |
needs: unit-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- name: Get package.json | |
id: get-package | |
run: echo PACKAGE=$(cat ./package.json) >> $GITHUB_OUTPUT | |
- name: Get package version | |
id: get-package-version | |
run: echo VERSION="${{ fromJson(steps.get-package.outputs.PACKAGE).version }}" >> $GITHUB_OUTPUT | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Publish | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Tag | |
run: | | |
git config --global user.name "ponlawat-w" | |
git config --global user.email "[email protected]" | |
git tag -fa "v${{ steps.get-package-version.outputs.VERSION }}" -F ./CHANGES.md | |
git push --force origin v${{ steps.get-package-version.outputs.VERSION }} | |
- name: Release | |
run: gh release create v${{ steps.get-package-version.outputs.VERSION }} -t v${{ steps.get-package-version.outputs.VERSION }} --notes-from-tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |