Skip to content

Commit f0a49a4

Browse files
committed
Merge pull request #7 from photon-hq/ENG-606-Write-Readme
write readme
2 parents b1f9199 + 72163c6 commit f0a49a4

4 files changed

Lines changed: 210 additions & 88 deletions

File tree

.github/actions/publish-npm/action.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ inputs:
2222
description: "[string] NPM tag (e.g., 'latest', 'beta')"
2323
required: false
2424
default: 'latest'
25-
dry-run:
26-
description: "[boolean: 'true'/'false'] Run npm publish --dry-run instead of actual publish"
27-
required: false
28-
default: 'false'
2925
npm-token:
3026
description: 'NPM authentication token'
3127
required: true
@@ -57,9 +53,4 @@ runs:
5753
working-directory: ${{ inputs.working-directory }}
5854
env:
5955
NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
60-
run: |
61-
if [ "${{ inputs.dry-run }}" == "true" ]; then
62-
npm publish --tag ${{ inputs.tag }} --access public --dry-run
63-
else
64-
npm publish --tag ${{ inputs.tag }} --access public
65-
fi
56+
run: npm publish --tag ${{ inputs.tag }} --access public

.github/workflows/rust-service-release.yaml

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,49 @@ on:
1010
binary-name:
1111
type: string
1212
required: true
13-
description: "The name of the crate/binary to build (from Cargo.toml, e.g., 'client')"
13+
description: "The name of the crate/binary to build (from Cargo.toml)"
1414
binary-path:
1515
type: string
1616
required: false
1717
default: ""
18-
description: "Optional: Path to crate directory (e.g., 'crates/client'). If empty, builds from workspace root using -p flag."
18+
description: "Path to crate directory (e.g., 'crates/client')"
19+
build-env:
20+
type: string
21+
required: false
22+
default: ""
23+
description: "Compile-time env vars (e.g., 'BASE_URL=https://example.com')"
24+
labels-to-check:
25+
type: string
26+
required: false
27+
default: '["github-release", "crates-release", "prerelease"]'
28+
description: "JSON array of PR labels to check for"
1929
prerelease:
2030
type: boolean
2131
required: false
2232
default: false
23-
description: "Whether to create a prerelease"
33+
description: "Force prerelease (overrides label)"
2434
github-release:
2535
type: boolean
2636
required: false
2737
default: false
28-
description: "Whether to create a GitHub release"
29-
build-env:
30-
type: string
31-
required: false
32-
default: ""
33-
description: "Compile-time env vars for .env file (e.g., 'BASE_URL=https://example.com')"
38+
description: "Force GitHub release (overrides label)"
3439
crates-release:
3540
type: boolean
3641
required: false
3742
default: false
38-
description: "Whether to publish to crates.io"
43+
description: "Force crates.io publish (overrides label)"
3944
dry-run:
4045
type: boolean
4146
required: false
4247
default: false
43-
description: "Run publish commands in dry-run mode (no actual publishing)"
48+
description: "Run in dry-run mode (no actual publishing)"
4449
secrets:
4550
OPENAI_API_KEY:
4651
required: true
4752
description: "OpenAI API key for version and notes"
4853
CARGO_REGISTRY_TOKEN:
4954
required: false
50-
description: "Crates.io API token (required if crates-release is true)"
55+
description: "Crates.io API token (required if crates-release)"
5156

5257
jobs:
5358
check-labels:
@@ -56,42 +61,42 @@ jobs:
5661
pull-requests: read
5762
contents: read
5863
outputs:
59-
has_github_release: ${{ steps.check-labels.outputs.has_github_release }}
60-
has_crates_release: ${{ steps.check-labels.outputs.has_crates_release }}
61-
has_prerelease: ${{ steps.check-labels.outputs.has_prerelease }}
64+
labels: ${{ steps.check.outputs.labels }}
6265
steps:
6366
- name: Check PR Labels
64-
id: check-labels
67+
id: check
6568
uses: photon-hq/buildspace/.github/actions/check-pr-label@main
69+
with:
70+
labels: ${{ inputs.labels-to-check }}
6671

6772
release-info:
6873
needs: check-labels
6974
if: |
70-
(needs.check-labels.outputs.has_github_release == 'true' || inputs.github-release) ||
71-
(needs.check-labels.outputs.has_crates_release == 'true' || inputs.crates-release)
75+
fromJSON(needs.check-labels.outputs.labels).github-release || inputs.github-release ||
76+
fromJSON(needs.check-labels.outputs.labels).crates-release || inputs.crates-release
7277
runs-on: ubuntu-latest
7378
permissions:
7479
contents: read
7580
outputs:
76-
version: ${{ steps.generate-release-info.outputs.version }}
77-
release_notes: ${{ steps.generate-release-info.outputs.release_notes }}
81+
version: ${{ steps.generate.outputs.version }}
82+
release_notes: ${{ steps.generate.outputs.release_notes }}
7883
steps:
7984
- uses: actions/checkout@v5
8085
with:
8186
fetch-depth: 0
8287
- name: Generate Release Info
83-
id: generate-release-info
88+
id: generate
8489
uses: photon-hq/buildspace/.github/actions/generate-release-info@main
85-
with:
86-
service-name: ${{ inputs.service-name }}
87-
prerelease: ${{ inputs.prerelease || needs.check-labels.outputs.has_prerelease == 'true' }}
90+
with:
91+
service-name: ${{ inputs.service-name }}
92+
prerelease: ${{ inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease }}
8893
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
8994

9095
build:
9196
name: Build ${{ matrix.target }}
9297
runs-on: ${{ matrix.os }}
9398
needs: [check-labels, release-info]
94-
if: needs.check-labels.outputs.has_github_release == 'true' || inputs.github-release
99+
if: fromJSON(needs.check-labels.outputs.labels).github-release || inputs.github-release
95100
strategy:
96101
fail-fast: false
97102
matrix:
@@ -111,39 +116,37 @@ jobs:
111116
binary-path: ${{ inputs.binary-path }}
112117
target: ${{ matrix.target }}
113118
build-env: ${{ inputs.build-env }}
114-
115119
- uses: actions/upload-artifact@v4
116120
with:
117121
name: ${{ inputs.binary-name }}-${{ matrix.target }}
118122
path: artifacts/*
119123

120124
github-release:
121125
needs: [check-labels, release-info, build]
122-
if: needs.check-labels.outputs.has_github_release == 'true' || inputs.github-release
126+
if: fromJSON(needs.check-labels.outputs.labels).github-release || inputs.github-release
123127
runs-on: ubuntu-latest
124128
permissions:
125129
contents: write
126130
steps:
127131
- name: Create GitHub Release
128-
id: create-release
129132
uses: photon-hq/buildspace/.github/actions/create-github-release@main
130-
with:
131-
version: ${{ needs.release-info.outputs.version }}
132-
title: "${{ inputs.service-name }} v${{ needs.release-info.outputs.version }}"
133-
notes: ${{ needs.release-info.outputs.release_notes }}
134-
prerelease: ${{ inputs.prerelease || needs.check-labels.outputs.has_prerelease == 'true' }}
135-
artifact-pattern: ${{ inputs.binary-name }}-*
133+
with:
134+
version: ${{ needs.release-info.outputs.version }}
135+
title: "${{ inputs.service-name }} v${{ needs.release-info.outputs.version }}"
136+
notes: ${{ needs.release-info.outputs.release_notes }}
137+
prerelease: ${{ inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease }}
138+
artifact-pattern: ${{ inputs.binary-name }}-*
136139

137140
crates-publish:
138141
needs: [check-labels, release-info]
139-
if: needs.check-labels.outputs.has_crates_release == 'true' || inputs.crates-release
142+
if: fromJSON(needs.check-labels.outputs.labels).crates-release || inputs.crates-release
140143
runs-on: ubuntu-latest
141144
steps:
142145
- uses: actions/checkout@v5
143146
- name: Publish to Crates.io
144147
uses: photon-hq/buildspace/.github/actions/publish-crates@main
145-
with:
146-
crate-name: ${{ inputs.binary-name }}
147-
crate-path: ${{ inputs.binary-path }}
148+
with:
149+
crate-name: ${{ inputs.binary-name }}
150+
crate-path: ${{ inputs.binary-path }}
148151
dry-run: ${{ inputs.dry-run }}
149152
cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

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

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@ on:
1212
required: false
1313
default: "latest"
1414
description: "Bun version to use"
15-
prerelease:
16-
type: boolean
17-
required: false
18-
default: false
19-
description: "Whether to create a prerelease"
20-
github-release:
21-
type: boolean
22-
required: false
23-
default: false
24-
description: "Whether to create a GitHub release"
25-
npm-release:
26-
type: boolean
27-
required: false
28-
default: false
29-
description: "Whether to publish to npm"
3015
npm-tag:
3116
type: string
3217
required: false
@@ -42,18 +27,38 @@ on:
4227
required: false
4328
default: "bun run build"
4429
description: "Build command"
30+
labels-to-check:
31+
type: string
32+
required: false
33+
default: '["github-release", "npm-release", "prerelease"]'
34+
description: "JSON array of PR labels to check for"
35+
prerelease:
36+
type: boolean
37+
required: false
38+
default: false
39+
description: "Force prerelease (overrides label)"
40+
github-release:
41+
type: boolean
42+
required: false
43+
default: false
44+
description: "Force GitHub release (overrides label)"
45+
npm-release:
46+
type: boolean
47+
required: false
48+
default: false
49+
description: "Force npm publish (overrides label)"
4550
dry-run:
4651
type: boolean
4752
required: false
4853
default: false
49-
description: "Run publish commands in dry-run mode (no actual publishing)"
54+
description: "Run in dry-run mode (no actual publishing)"
5055
secrets:
5156
OPENAI_API_KEY:
5257
required: true
5358
description: "OpenAI API key for version and notes"
5459
NPM_TOKEN:
5560
required: false
56-
description: "NPM token (required if npm-release is true)"
61+
description: "NPM token (required if npm-release)"
5762

5863
jobs:
5964
check-labels:
@@ -62,66 +67,65 @@ jobs:
6267
pull-requests: read
6368
contents: read
6469
outputs:
65-
has_github_release: ${{ steps.check-labels.outputs.has_github_release }}
66-
has_npm_release: ${{ steps.check-labels.outputs.has_npm_release }}
67-
has_prerelease: ${{ steps.check-labels.outputs.has_prerelease }}
70+
labels: ${{ steps.check.outputs.labels }}
6871
steps:
6972
- name: Check PR Labels
70-
id: check-labels
73+
id: check
7174
uses: photon-hq/buildspace/.github/actions/check-pr-label@main
75+
with:
76+
labels: ${{ inputs.labels-to-check }}
7277

7378
release-info:
7479
needs: check-labels
7580
if: |
76-
(needs.check-labels.outputs.has_github_release == 'true' || inputs.github-release) ||
77-
(needs.check-labels.outputs.has_npm_release == 'true' || inputs.npm-release)
81+
fromJSON(needs.check-labels.outputs.labels).github-release || inputs.github-release ||
82+
fromJSON(needs.check-labels.outputs.labels).npm-release || inputs.npm-release
7883
runs-on: ubuntu-latest
7984
permissions:
8085
contents: read
8186
outputs:
82-
version: ${{ steps.generate-release-info.outputs.version }}
83-
release_notes: ${{ steps.generate-release-info.outputs.release_notes }}
87+
version: ${{ steps.generate.outputs.version }}
88+
release_notes: ${{ steps.generate.outputs.release_notes }}
8489
steps:
8590
- uses: actions/checkout@v5
8691
with:
8792
fetch-depth: 0
8893
- name: Generate Release Info
89-
id: generate-release-info
94+
id: generate
9095
uses: photon-hq/buildspace/.github/actions/generate-release-info@main
91-
with:
92-
service-name: ${{ inputs.service-name }}
93-
prerelease: ${{ inputs.prerelease || needs.check-labels.outputs.has_prerelease == 'true' }}
96+
with:
97+
service-name: ${{ inputs.service-name }}
98+
prerelease: ${{ inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease }}
9499
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
95100

96101
github-release:
97102
needs: [check-labels, release-info]
98-
if: needs.check-labels.outputs.has_github_release == 'true' || inputs.github-release
103+
if: fromJSON(needs.check-labels.outputs.labels).github-release || inputs.github-release
99104
runs-on: ubuntu-latest
100105
permissions:
101106
contents: write
102107
steps:
103108
- name: Create GitHub Release
104-
id: create-release
105109
uses: photon-hq/buildspace/.github/actions/create-github-release@main
106-
with:
107-
version: ${{ needs.release-info.outputs.version }}
108-
title: "${{ inputs.service-name }} v${{ needs.release-info.outputs.version }}"
109-
notes: ${{ needs.release-info.outputs.release_notes }}
110-
prerelease: ${{ inputs.prerelease || needs.check-labels.outputs.has_prerelease == 'true' }}
110+
with:
111+
version: ${{ needs.release-info.outputs.version }}
112+
title: "${{ inputs.service-name }} v${{ needs.release-info.outputs.version }}"
113+
notes: ${{ needs.release-info.outputs.release_notes }}
114+
prerelease: ${{ inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease }}
111115

112116
npm-publish:
113117
needs: [check-labels, release-info]
114-
if: needs.check-labels.outputs.has_npm_release == 'true' || inputs.npm-release
118+
if: fromJSON(needs.check-labels.outputs.labels).npm-release || inputs.npm-release
115119
runs-on: ubuntu-latest
116120
permissions:
117121
contents: read
118122
steps:
119123
- uses: actions/checkout@v5
120124
- name: Publish to NPM
121125
uses: photon-hq/buildspace/.github/actions/publish-npm@main
122-
with:
123-
bun-version: ${{ inputs.bun-version }}
124-
tag: ${{ (inputs.prerelease || needs.check-labels.outputs.has_prerelease == 'true') && 'beta' || inputs.npm-tag }}
126+
with:
127+
bun-version: ${{ inputs.bun-version }}
128+
tag: ${{ (inputs.prerelease || fromJSON(needs.check-labels.outputs.labels).prerelease) && 'beta' || inputs.npm-tag }}
125129
working-directory: ${{ inputs.working-directory }}
126130
build-command: ${{ inputs.build-command }}
127131
dry-run: ${{ inputs.dry-run }}

0 commit comments

Comments
 (0)