Files
lume/.github/workflows/npm-publish-computer.yml
2025-12-31 22:55:51 +05:30

74 lines
2.0 KiB
YAML

name: Publish @trycua/computer to npm
on:
push:
branches: main
workflow_dispatch:
inputs:
version:
description: "Version to publish (default: from package.json)"
required: false
default: ""
workflow_call:
inputs:
version:
description: "Version to publish (default: from package.json)"
required: false
type: string
default: ""
permissions:
id-token: write
contents: write
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
tag: ${{ steps.get-version.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine version
id: get-version
run: |
# Check inputs.version first (works for workflow_call)
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
else
# Read from package.json
VERSION=$(node -p "require('./libs/typescript/computer/package.json').version")
fi
echo "Computer version: $VERSION"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag=npm-computer-v${VERSION}" >> $GITHUB_OUTPUT
publish:
needs: prepare
uses: ./.github/workflows/npm-reusable-publish.yml
with:
package_name: "computer"
package_dir: "libs/typescript/computer"
package_manager: "pnpm"
version: ${{ needs.prepare.outputs.version }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
create-release:
needs: [prepare, publish]
uses: ./.github/workflows/github-release-reusable.yml
with:
tag_name: ${{ needs.prepare.outputs.tag }}
release_name: "@trycua/computer v${{ needs.prepare.outputs.version }}"
body: |
## Installation
```bash
npm install @trycua/computer
```