Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 11 additions & 69 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,19 @@ name: Release
on:
push:
branches: [main]
paths:
- "specs/telegram-bot-api.openapi.json"
workflow_dispatch:

Comment on lines 3 to 6
# No NPM_TOKEN: publishing uses npm Trusted Publishing (OIDC) + provenance.
# One-time setup: create the `@photon-ai` scope on npm and register this repo +
# workflow as a Trusted Publisher for `@photon-ai/telegram-ts`.
permissions:
contents: write # create git tag + GitHub Release
id-token: write # OIDC token exchange for npm Trusted Publishing

concurrency:
group: release
cancel-in-progress: false
contents: write
pull-requests: read
id-token: write

Comment on lines 7 to 11
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
# Need full history + tags to diff the spec against the last release.
fetch-depth: 0
fetch-tags: true

# Trusted Publishing requires npm >= 11.5.1 (ships with Node >= 22.14).
- uses: actions/setup-node@v4
with:
node-version: "22.14.0"
registry-url: "https://registry.npmjs.org"
- run: npm install --global npm@latest

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.5

- run: bun install --frozen-lockfile

- name: Generate client + build
run: |
bun run generate:client
bun run build

- name: Typecheck
run: bun run typecheck

- name: Test
run: bun run test

- name: Compute next version
id: version
run: bun run compute:version

- name: Set package version
if: steps.version.outputs.should_publish == 'true'
working-directory: packages/telegram-ts
run: npm pkg set version=${{ steps.version.outputs.version }}

- name: Publish to npm (Trusted Publishing + provenance)
if: steps.version.outputs.should_publish == 'true'
working-directory: packages/telegram-ts
run: npm publish --provenance --access public

- name: Tag + GitHub Release
if: steps.version.outputs.should_publish == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="v${{ steps.version.outputs.version }}"
git tag "$TAG"
git push origin "$TAG"
gh release create "$TAG" \
--title "$TAG" \
--notes "Telegram Bot API ${{ steps.version.outputs.telegram_version }} — published \`@photon-ai/telegram-ts@${{ steps.version.outputs.version }}\`."
uses: photon-hq/buildspace/.github/workflows/typescript-service-release.yaml@main
with:
service-name: telegram-ts
working-directory: packages/telegram-ts
build-command: "bun run build"
use-oidc: true
dry-run: false
secrets: inherit