-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (57 loc) · 1.94 KB
/
npm-publish.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Publish package
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
permissions:
contents: read
packages: write
jobs:
build:
# allow failure publishing to npm for now
# TODO: remove this once we have a token
continue-on-error: ${{ matrix.registry.url == 'https://registry.npmjs.org' }}
strategy:
matrix:
registry:
- url: https://registry.npmjs.org
token_secret: NPM_TOKEN
- url: https://npm.pkg.github.com
token_secret: GITHUB_TOKEN
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: pnpm
registry-url: ${{ matrix.registry.url }}
scope: "@invoke-ai"
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets[matrix.registry.token_secret] }}
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Version bump
# only if manual workflow dispatch and not on a tag
if: github.event_name == 'workflow_dispatch' && !startsWith(github.ref, 'refs/tags/')
run: npm version prepatch --preid=$(git rev-parse --short HEAD) --no-git-tag-version
- name: Publish
shell: bash
run: |
# manual workflow dispatches are tagged as pre-release - all releases should go through proper tagging process
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
FLAGS="--tag pre"
fi
pnpm publish --access public --no-git-checks $FLAGS
env:
NODE_AUTH_TOKEN: ${{ secrets[matrix.registry.token_secret] }}
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}