Skip to content

publish-event

publish-event #5

Workflow file for this run

name: Publish
on:
repository_dispatch:
types: [publish-event]
jobs:
publish_npm:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set version
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Check version
run: echo "Version ${{ github.event.client_payload.new-tag }}"
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install yarn
run: yarn install
- name: Build application
run: yarn build
- name: Setup Git user
run: |
git config --global user.name "Github Bot"
git config --global user.email "[email protected]"
- name: Create .npmrc file
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Bump NPM version
run: npm --no-git-tag-version --allow-same-version version ${{ github.event.client_payload.new-tag }}
- name: NPM publish
run: npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}