CI(GitHub Actions): add npm autopublishing script
Summary: Handles (eslint|prettier)-config in one script. Signed-off-by: Yongmin Hong <revi@omglol.email> Test Plan: `arc land` and push a tag for testing. Reviewers: O1 revi & automations, revi Reviewed By: O1 revi & automations, revi Differential Revision: https://issuetracker.revi.xyz/D356
This commit is contained in:
parent
5c16c87f8d
commit
351abd6425
1 changed files with 49 additions and 0 deletions
49
.github/workflows/npm-pub.yml
vendored
Normal file
49
.github/workflows/npm-pub.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
---
|
||||||
|
name: Publish Package to npmjs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'eslint-config@v*'
|
||||||
|
- 'prettier-config@v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
eslint-config:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref_name == 'eslint-config@v*'
|
||||||
|
steps:
|
||||||
|
- name: 'Checkout'
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
# Setup .npmrc file to publish to npm
|
||||||
|
- name: 'Setup node.js'
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- name: 'Install dependencies'
|
||||||
|
run: npm ci --fund=false
|
||||||
|
- name: 'Publish to npm'
|
||||||
|
run: npm publish --provenance --access public
|
||||||
|
working-directory: './npm/eslint-config'
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
prettier-config:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref_name == 'prettier-config@v*'
|
||||||
|
steps:
|
||||||
|
- name: 'Checkout'
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
# Setup .npmrc file to publish to npm
|
||||||
|
- name: 'Setup node.js'
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- name: 'Install dependencies'
|
||||||
|
run: npm ci --fund=false
|
||||||
|
- name: 'Publish to npm'
|
||||||
|
run: npm publish --provenance --access public
|
||||||
|
working-directory: './npm/prettier-config'
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
Loading…
Reference in a new issue