Skip to content

Publish package

Publish package #29

Workflow file for this run

name: Publish package
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
permissions:
contents: read
packages: write
jobs:
build:
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] }}
- 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] }}