Issue 44 - Check if document is defined before using #22
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 Package on PR Merge | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
build: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: yarn install | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: install | |
- name: yarn build | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: build | |
- name: yarn lint | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: lint | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- name: Git config | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email github-actions[bot]@users.noreply.github.com | |
- name: Apply version bump (major) | |
if: contains(github.event.pull_request.labels.*.name, 'major') | |
run: npm version major | |
- name: Apply version bump (minor) | |
if: contains(github.event.pull_request.labels.*.name, 'minor') | |
run: npm version minor | |
- name: Apply version bump (patch) | |
if: contains(github.event.pull_request.labels.*.name, 'patch') | |
run: npm version patch | |
- name: Git push version bump | |
run: git push origin main --follow-tags --force | |
- id: set-version | |
name: Output version change | |
run: npm pkg get version | |
- name: npm install | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: install | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |