-
Notifications
You must be signed in to change notification settings - Fork 57
35 lines (32 loc) · 1.03 KB
/
garbo-lib.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Publish package to NPM
on:
push:
paths:
- "packages/garbo-lib/package.json"
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Check publish status
id: check
run: |
NEXT_VERSION=$(jq -r '.version' < packages/garbo-lib/package.json)
STATUS=$(curl --write-out '%{http_code}\n' --head --silent --output /dev/null https://registry.npmjs.org/garbo-lib/$NEXT_VERSION)
echo "status=$STATUS" >> "$GITHUB_OUTPUT"
- name: Publish if necessary
if: ${{ steps.check.outputs.status == '404' }}
run: |
yarn workspace garbo-lib install
yarn workspace garbo-lib build
yarn workspace garbo-lib npm publish
env:
STATUS: ${{ steps.check.outputs.status }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}