chore: add publish npm action #31
This file contains 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
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 }} |