Skip to content

Commit 208fde3

Browse files
committed
chore(ci): strip unnecessary parts until it works
1 parent d79ae89 commit 208fde3

File tree

2 files changed

+6
-109
lines changed

2 files changed

+6
-109
lines changed

.github/workflows/publish.yml

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ on:
66
push:
77
branches: [master]
88
workflow_dispatch:
9-
inputs:
10-
version_specifier:
11-
description: 'Semver bump (patch|minor|major|pre*) or exact version (v1.2.3)'
12-
required: true
13-
type: string
149

1510
env:
1611
NODE_VERSION: '20'
@@ -30,42 +25,6 @@ jobs:
3025
with:
3126
app-id: ${{ secrets.APP_ID }}
3227
private-key: ${{ secrets.PRIVATE_KEY }}
33-
- name: Check if actor is member of admin or client-libs team
34-
id: team-check
35-
uses: actions/github-script@v7
36-
with:
37-
github-token: ${{ steps.app-token.outputs.token }}
38-
script: |
39-
const org = 'supabase'
40-
const { actor } = context
41-
42-
async function isTeamMember(team_slug) {
43-
try {
44-
const res = await github.rest.teams.getMembershipForUserInOrg({
45-
org,
46-
team_slug,
47-
username: actor,
48-
})
49-
console.log('res', JSON.stringify(res, null, 2))
50-
return res && res.status === 200
51-
} catch (_) {
52-
return false
53-
}
54-
}
55-
56-
const isAdmin = await isTeamMember('admin')
57-
const isClientLibs = await isTeamMember('client-libs')
58-
const isMember = isAdmin || isClientLibs
59-
console.log('isAdmin', isAdmin)
60-
console.log('isClientLibs', isClientLibs)
61-
console.log('isMember', isMember)
62-
core.setOutput('is_team_member', isMember ? 'true' : 'false')
63-
64-
- name: Fail if not authorized
65-
if: ${{ steps.team-check.outputs.is_team_member != 'true' }}
66-
run: |
67-
echo "You must be a member of @supabase/admin or @supabase/client-libs."
68-
exit 1
6928

7029
- uses: actions/checkout@v5
7130
with:
@@ -87,36 +46,21 @@ jobs:
8746
git config --global user.name "supabase-releaser[bot]"
8847
git config --global user.email "supabase-releaser[bot]@users.noreply.github.com"
8948
90-
- name: Validate input
91-
run: |
92-
VS="${{ github.event.inputs.version_specifier }}"
93-
echo "Validating: $VS"
94-
95-
if [[ "$VS" =~ ^(patch|minor|major|prepatch|preminor|premajor|prerelease)$ ]]; then
96-
echo "✔ bump keyword"
97-
elif [[ "$VS" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
98-
echo "✔ explicit version"
99-
else
100-
echo "❌ Invalid version_specifier: '$VS'"
101-
echo " Use: patch|minor|major|pre*, or v1.2.3"
102-
exit 1
103-
fi
104-
10549
- name: Set git remote to use App token
10650
run: git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/supabase/supabase-js.git
107-
51+
10852
- name: Authenticate gh CLI with App token
10953
env:
11054
GH_TOKEN: ${{ steps.app-token.outputs.token }}
11155
run: |
112-
gh auth login --with-token
113-
56+
gh auth login --with-token
57+
11458
- name: Create and push branch with gh CLI
11559
run: |
11660
git checkout --orphan test-token-push
11761
git commit --allow-empty -m "chore(repo): test push"
11862
git push origin test-token-push
119-
63+
12064
- name: Create pull request with gh CLI
12165
run: |
12266
gh pr create \
@@ -131,14 +75,7 @@ jobs:
13175
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13276
RELEASE_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
13377
run: |
134-
npm run release-stable -- --versionSpecifier "${{ github.event.inputs.version_specifier }}"
135-
- name: Summary
136-
if: ${{ success() }}
137-
run: |
138-
echo "## ✅ Stable Release" >> $GITHUB_STEP_SUMMARY
139-
echo "- **Version specifier:** \`${{ github.event.inputs.version_specifier }}\`" >> $GITHUB_STEP_SUMMARY
140-
echo "- **Source commit:** HEAD of the checked-out branch" >> $GITHUB_STEP_SUMMARY
141-
echo "- **Dist-tag:** \`latest\`" >> $GITHUB_STEP_SUMMARY
78+
npm run release-stable
14279
14380
trigger-update-js-libs:
14481
name: Trigger Update JS Libs
@@ -201,4 +138,4 @@ jobs:
201138
version: '2.74.0',
202139
source: 'supabase-js-stable-release'
203140
}
204-
});
141+
});

scripts/release-stable.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,4 @@
1-
import { releaseVersion, releaseChangelog, releasePublish } from 'nx/release'
21
import { execSync } from 'child_process'
3-
4-
function getArg(name: string): string | undefined {
5-
// supports --name=value and --name value
6-
const idx = process.argv.findIndex((a) => a === `--${name}` || a.startsWith(`--${name}=`))
7-
if (idx === -1) return undefined
8-
const token = process.argv[idx]
9-
if (token.includes('=')) return token.split('=')[1]
10-
return process.argv[idx + 1] // next token
11-
}
12-
13-
const versionSpecifier = getArg('versionSpecifier') ?? process.argv[2] // optional positional fallback
14-
15-
if (!versionSpecifier) {
16-
console.error(
17-
`Usage: npm run release-stable -- --versionSpecifier <specifier>\n` +
18-
`Examples:\n` +
19-
` --versionSpecifier patch | minor | major | prepatch | preminor | premajor | prerelease\n` +
20-
` --versionSpecifier v2.3.4 (explicit version)\n`
21-
)
22-
process.exit(1)
23-
}
24-
25-
// Validate versionSpecifier to prevent command injection
26-
const validSpecifiers = [
27-
'patch',
28-
'minor',
29-
'major',
30-
'prepatch',
31-
'preminor',
32-
'premajor',
33-
'prerelease',
34-
]
35-
const isValidVersion = /^v?\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/.test(versionSpecifier)
36-
if (!validSpecifiers.includes(versionSpecifier) && !isValidVersion) {
37-
console.error(`❌ Invalid version specifier: ${versionSpecifier}`)
38-
console.error(`Must be one of: ${validSpecifiers.join(', ')} or a valid semver version`)
39-
process.exit(1)
40-
}
41-
422
;(async () => {
433
if (process.env.RELEASE_GITHUB_TOKEN) {
444
const remoteUrl = `https://x-access-token:${process.env.RELEASE_GITHUB_TOKEN}@github.com/supabase/supabase-js.git`

0 commit comments

Comments
 (0)