Skip to content

Merge pull request #7 from photon-hq/ENG-606-Write-Readme #13

Merge pull request #7 from photon-hq/ENG-606-Write-Readme

Merge pull request #7 from photon-hq/ENG-606-Write-Readme #13

name: TypeScript Service Release
on:
workflow_call:
inputs:
service-name:
type: string
required: true
description: "The name of the service to release"
bun-version:
type: string
required: false
default: "latest"
description: "Bun version to use"
npm-tag:
type: string
required: false
default: "latest"
description: "NPM tag to publish with"
working-directory:
type: string
required: false
default: "."
description: "Directory containing package.json"
build-command:
type: string
required: false
default: "bun run build"
description: "Build command"
labels-to-check:
type: string
required: false
default: '["github-release", "npm-release", "prerelease"]'
description: "JSON array of PR labels to check for"
prerelease:
type: boolean
required: false
default: false
description: "Force prerelease (overrides label)"
github-release:
type: boolean
required: false
default: false
description: "Force GitHub release (overrides label)"
npm-release:
type: boolean
required: false
default: false
description: "Force npm publish (overrides label)"
dry-run:
type: boolean
required: false
default: false
description: "Run in dry-run mode (no actual publishing)"
secrets:
OPENAI_API_KEY:
required: true
description: "OpenAI API key for version and notes"
NPM_TOKEN:
required: false
description: "NPM token (required if npm-release)"
jobs:
check-labels:
runs-on: ubuntu-latest
permissions:
pull-requests: read
contents: read
outputs:
labels: ${{ steps.check.outputs.labels }}
steps:
- name: Check PR Labels
id: check
uses: photon-hq/buildspace/.github/actions/check-pr-label@main
with:
labels: ${{ inputs.labels-to-check }}
release-info:
needs: check-labels
if: |
fromJSON(needs.check-labels.outputs.labels).github-release || inputs.github-release ||
fromJSON(needs.check-labels.outputs.labels).npm-release || inputs.npm-release
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.generate.outputs.version }}
release_notes: ${{ steps.generate.outputs.release_notes }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Generate Release Info
id: generate
uses: photon-hq/buildspace/.github/actions/generate-release-info@main
with:
service-name: ${{ inputs.service-name }}
prerelease: ${{ inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease }}

Check failure on line 98 in .github/workflows/typescript-service-release.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/typescript-service-release.yaml

Invalid workflow file

You have an error in your yaml syntax on line 98
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
github-release:
needs: [check-labels, release-info]
if: fromJSON(needs.check-labels.outputs.labels).github-release || inputs.github-release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create GitHub Release
uses: photon-hq/buildspace/.github/actions/create-github-release@main
with:
version: ${{ needs.release-info.outputs.version }}
title: "${{ inputs.service-name }} v${{ needs.release-info.outputs.version }}"
notes: ${{ needs.release-info.outputs.release_notes }}
prerelease: ${{ inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease }}
npm-publish:
needs: [check-labels, release-info]
if: fromJSON(needs.check-labels.outputs.labels).npm-release || inputs.npm-release
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v5
- name: Publish to NPM
uses: photon-hq/buildspace/.github/actions/publish-npm@main
with:
bun-version: ${{ inputs.bun-version }}
tag: ${{ (inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease) && 'beta' || inputs.npm-tag }}
working-directory: ${{ inputs.working-directory }}
build-command: ${{ inputs.build-command }}
dry-run: ${{ inputs.dry-run }}
npm-token: ${{ secrets.NPM_TOKEN }}