Skip to content

Commit d5ba6ba

Browse files
authored
Enable public release automation (#16)
1 parent 42ab801 commit d5ba6ba

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

.github/workflows/CI.yml

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -485,32 +485,21 @@ jobs:
485485
- name: List packages
486486
run: ls -R ./npm
487487
shell: bash
488-
- name: Publish Dev
489-
shell: bash
490-
env:
491-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
492-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
488+
- name: Publish
489+
if: contains(github.ref, "main")
493490
run: |
494491
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
495492
npm config set scope "@platformatic"
496-
npm publish --tag dev
497-
498-
# TODO: Maybe restrict by branch, not just commit format?
499-
# TODO: Enable this when we're ready to go public.
500-
# - name: Publish
501-
# run: |
502-
# npm config set provenance true
503-
# if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
504-
# then
505-
# echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
506-
# npm publish # --access public
507-
# elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
508-
# then
509-
# echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
510-
# npm publish --tag next # --access public
511-
# else
512-
# echo "Not a release, skipping publish"
513-
# fi
514-
# env:
515-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
516-
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
493+
npm config set provenance true
494+
if git log -1 --pretty=%B | grep "^v?[0-9]\+\.[0-9]\+\.[0-9]\+$";
495+
then
496+
npm publish --access public
497+
elif git log -1 --pretty=%B | grep "^v?[0-9]\+\.[0-9]\+\.[0-9]\+";
498+
then
499+
npm publish --tag next --access public
500+
else
501+
echo "Not a release, skipping publish"
502+
fi
503+
env:
504+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
505+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)