Merge pull request #31 from tomarks/main #28
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: Increment & Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
uses: ./.github/workflows/run-tests.yml | |
version: | |
name: Auto-Update Minor Version | |
runs-on: ubuntu-latest | |
needs: test | |
if: "!startsWith(github.event.head_commit.message, '[RELEASE]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure git | |
run: | | |
git config --global user.name 'github action' | |
git config --global user.email '[email protected]' | |
- name: Patch npm version | |
run: npm version patch -m "[RELEASE] %s" | |
- name: Update repo | |
run: git push | |
publish: | |
name: Publish to NPMjs | |
runs-on: ubuntu-latest | |
needs: [test, version] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Setup .npmrc file to publish to npm | |
- name: setup node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: npm ci | |
- name: Build project | |
run: npm run build | |
- name: Print version and other checks | |
run: | | |
grep version package.json | awk -F \" '{print $4}' | |
ls dist | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |