Skip to content

Commit

Permalink
chore: set latest NPM tag on release (#446)
Browse files Browse the repository at this point in the history
* Add script

* Remove publish scripts

* Update workflow

* Fix path
  • Loading branch information
sebastijankuzner authored Feb 22, 2024
1 parent 1bf022a commit 163ba87
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ jobs:
- name: Publish to NPM
run: |
pnpm run release -- --publish-branch=develop --tag=alpha
- name: Set dist-tag latest
run: |
bash ./scripts/dist-tag-latest.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

strategy:
matrix:
node-version:
Expand Down
13 changes: 13 additions & 0 deletions scripts/dist-tag-latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

for dir in `find packages -mindepth 1 -maxdepth 1 -type d | sort -nr`; do
json=$(<"$dir/package.json")
# Remove leading/trailing whitespace
json=$(echo "$json" | tr -d '\n' | tr -d '\r' | sed 's/ //g')
# Extract name and version
name=$(echo "$json" | sed 's/.*"name":"\([^"]*\)".*/\1/')
version=$(echo "$json" | sed 's/.*"version":"\([^"]*\)".*/\1/')
echo $name@$version

pnpm dist-tag add $name@$version latest
done
9 changes: 0 additions & 9 deletions scripts/publish/alpha.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/publish/beta.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/publish/latest.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/publish/next.sh

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/publish/rc.sh

This file was deleted.

0 comments on commit 163ba87

Please sign in to comment.