-
Notifications
You must be signed in to change notification settings - Fork 102
[wip] chore: add publish npm action #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
juleswritescode
wants to merge
41
commits into
supabase-community:main
from
juleswritescode:chore/add-publish-action
Closed
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
064b3f2
chore: add publish npm action
juleswritescode a9f36e7
don't have that yet
juleswritescode 3e24df4
copy that schema
juleswritescode 4afd792
add thangs
juleswritescode 125f8fc
ok?
juleswritescode 6baf503
trim names
juleswritescode 6b0aa3d
debug thing
juleswritescode eaf3097
ok?
juleswritescode 0ce8fa3
changy change
juleswritescode f63de17
like so?
juleswritescode d7cf708
make it test
juleswritescode dbe1924
well
juleswritescode 9e3e092
thats not a valid alias
juleswritescode 711fb48
use pipes
juleswritescode f4abd92
rework
juleswritescode 38e30cf
ocd
juleswritescode 584c67a
wrong platform name
juleswritescode ebd6760
debug
juleswritescode c698b4c
well...
juleswritescode 10d0822
more sexy
juleswritescode 92c9658
thats not an underscore
juleswritescode 348dfaf
schema src
juleswritescode d436948
escape?
juleswritescode a1607c5
cleanup
juleswritescode c3b03b2
herantasten
juleswritescode bbde5f7
these underscores dang
juleswritescode 29e9dbd
it apparently works
juleswritescode 9250363
restructure
juleswritescode 7a4f004
ls that stuff
juleswritescode 59bd643
cat instead
juleswritescode 7aed7f4
this the script?
juleswritescode 5bf5a70
desc
juleswritescode 9d190c7
prepwork
juleswritescode 82cf431
improve left & right
juleswritescode ee914d7
test-release name
juleswritescode 72499a5
?
juleswritescode 0661574
ok
juleswritescode ea97ad8
ack
juleswritescode 78be9bf
another
juleswritescode d920fc9
verify
juleswritescode 099350c
ok
juleswritescode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Publish NPM (Manual) | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_tag: | ||
type: string | ||
required: true | ||
description: Release Tag to Publish | ||
|
||
jobs: | ||
validate_tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v7 | ||
id: validate-release | ||
with: | ||
script: | | ||
const tag = core.getInput('release_tag', { required: true }); | ||
|
||
let exhausted = false; | ||
let page = 1; | ||
while (!exhausted) { | ||
const releases = octokit.rest.repos.listReleases({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
page, | ||
per_page: 100, | ||
}); | ||
|
||
const matchingRelease = releases.find(r => r.tag_name === tag); | ||
if (matchingRelease) { | ||
core.setOutput('hasRelease', true); | ||
core.setOutput('isPrerelease', release.prerelease); | ||
return; | ||
} | ||
|
||
if (releases.length < 100) { | ||
exhausted = true; | ||
} else { | ||
page++ | ||
} | ||
} | ||
|
||
core.setOutput('hasRelease', false); | ||
core.setOutput('isPrerelease', false); | ||
|
||
- name: Abort | ||
if: ${{ !steps.validate-release.outputs.hasRelease }} | ||
run: | | ||
{ | ||
echo "Tag ${{ github.event.inputs.release_tag }} not found." | ||
exit 1 | ||
} | ||
|
||
- name: Print Output | ||
run: | | ||
{ | ||
echo "Has Release: ${{ steps.validate-release.outputs.hasRelease }}" | ||
echo "Is Prerelease: ${{ steps.validate-release.outputs.isPrerelease }}" | ||
} | ||
|
||
# publish_npm: | ||
# needs: validate_tag | ||
# uses: ./.github/workflows/publish.reusable.yml | ||
# with: | ||
# release-tag: ${{ github.event.inputs.release_tag }} | ||
# secrets: inherit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Publish to NPM & Brew | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- supabase-community:main | ||
|
||
jobs: | ||
publish: | ||
name: Publish All the Things | ||
runs-on: ubuntu-latest | ||
|
||
# todo: add secrets | ||
permissions: | ||
contents: write | ||
# ? what's this?! required for executing the node script? | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Generate Packages | ||
run: node packages/@pglt/pglt/scripts/generate-packages.mjs | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_TAG: "0.1.0" | ||
PRERELEASE: ${{ env.PRERELEASE }} | ||
|
||
- name: Verify NPM TOKEN exists | ||
run: | | ||
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then | ||
echo "Secret is not defined" | ||
exit 1 | ||
else | ||
echo "Secret is defined" | ||
fi | ||
|
||
- name: Publish npm packages as nightly | ||
if: false | ||
run: | | ||
for package in packages/@pglt/*; do | ||
npm publish $package --tag nightly --access public --provenance | ||
done | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # | ||
|
||
- name: Publish npm packages as latest | ||
if: true | ||
run: | | ||
for package in packages/@pglt/*; do | ||
npm publish $package --tag latest --access public --provenance | ||
done | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Publish NPM (Automatic) | ||
|
||
on: | ||
release: | ||
types: [released, prereleased] | ||
|
||
jobs: | ||
publish_npm: | ||
uses: ./.github/workflows/publish.reusable.yml | ||
with: | ||
release-tag: ${{ github.event.release.tag_name }} | ||
is-prerelease: ${{ github.event.release.prerelease }} | ||
secrets: inherit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env node | ||
const { platform, arch, env } = process; | ||
|
||
/** | ||
* platform and arch are values injected into the node runtime. | ||
* We use the values documented on https://nodejs.org. | ||
*/ | ||
const PLATFORMS = { | ||
win32: { | ||
x64: "@pglt/testrelease-cli-x86_64-windows-msvc/pglt.exe", | ||
arm64: "@pglt/testrelease-cli-aarch64-windows-msvc/pglt.exe", | ||
}, | ||
darwin: { | ||
x64: "@pglt/testrelease-cli-x86_64-apple-darwin/pglt", | ||
arm64: "@pglt/testrelease-cli-aarch64-apple-darwin/pglt", | ||
}, | ||
linux: { | ||
x64: "@pglt/testrelease-cli-x86_64-linux-gnu/pglt", | ||
arm64: "@pglt/testrelease-cli-aarch64-linux-gnu/pglt", | ||
}, | ||
}; | ||
|
||
const binPath = env.PGLT_BINARY || PLATFORMS?.[platform]?.[arch]; | ||
|
||
if (binPath) { | ||
const result = require("child_process").spawnSync( | ||
require.resolve(binPath), | ||
process.argv.slice(2), | ||
{ | ||
shell: false, | ||
stdio: "inherit", | ||
env, | ||
} | ||
); | ||
|
||
if (result.error) { | ||
throw result.error; | ||
} | ||
|
||
process.exitCode = result.status; | ||
} else { | ||
console.error( | ||
"The pglt CLI package doesn't ship with prebuilt binaries for your platform yet. Please file an issue in the main repository." | ||
); | ||
process.exitCode = 1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "pglt", | ||
"version": "<placeholder>", | ||
"bin": { | ||
"pglt": "bin/pglt" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/supabase/postgres_lsp.git", | ||
"directory": "packages/@pglt/pglt" | ||
}, | ||
"author": "Supabase Community", | ||
"contributors": [ | ||
{ | ||
"name": "Philipp Steinrötter", | ||
"url": "https://github.com/psteinroe" | ||
}, | ||
{ | ||
"name": "Julian Domke", | ||
"url": "https://github.com/juleswritescode" | ||
} | ||
], | ||
"license": "MIT or Apache-2.0", | ||
"description": "A collection of language tools and a Language Server Protocol (LSP) implementation for Postgres, focusing on developer experience and reliable SQL tooling.", | ||
"files": [ | ||
"bin/pglt", | ||
"schema.json" | ||
], | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"optionalDependencies": { | ||
"@pglt/testrelease-cli-aarch64-apple-darwin": "<placeholder>", | ||
"@pglt/testrelease-cli-aarch64-windows-msvc": "<placeholder>", | ||
"@pglt/testrelease-cli-aarch64-linux-gnu": "<placeholder>", | ||
"@pglt/testrelease-cli-x86_64-apple-darwin": "<placeholder>", | ||
"@pglt/testrelease-cli-x86_64-windows-msvc": "<placeholder>", | ||
"@pglt/testrelease-cli-x86_64-linux-gnu": "<placeholder>" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.