Skip to content

Publish package

Publish package #22

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: ${{ secrets.NPM_TOKEN }}
- url: https://npm.pkg.github.com
# token: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
# cache: pnpm # disable caching for now - it does not cache node_modules
registry-url: ${{ matrix.registry.url }}
scope: "@invoke-ai"
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
env:
# NODE_AUTH_TOKEN: ${{ matrix.registry.token }}
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: ${{ matrix.registry.token }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}