Browse Source

Fix publish script

master
TheoryOfNekomata 4 years ago
parent
commit
bdc24e8087
2 changed files with 8 additions and 3 deletions
  1. +2
    -0
      package.json
  2. +6
    -3
      publish.sh

+ 2
- 0
package.json View File

@@ -10,12 +10,14 @@
], ],
"publishing": { "publishing": {
"github": { "github": {
"name": "@temoto-kun/react-musical-keyboard",
"repository": "https://github.com/Temoto-kun/react-musical-keyboard.git", "repository": "https://github.com/Temoto-kun/react-musical-keyboard.git",
"publishConfig": { "publishConfig": {
"registry": "https://npm.pkg.github.com" "registry": "https://npm.pkg.github.com"
} }
}, },
"master": { "master": {
"name": "@theoryofnekomata/react-musical-keyboard",
"repository": "https://code.modal.sh/TheoryOfNekomata/react-musical-keyboard.git", "repository": "https://code.modal.sh/TheoryOfNekomata/react-musical-keyboard.git",
"publishConfig": { "publishConfig": {
"registry": "https://js.pack.modal.sh" "registry": "https://js.pack.modal.sh"


+ 6
- 3
publish.sh View File

@@ -9,9 +9,7 @@ for branch in $(cat package.json | jq .publishing | jq -r keys[]) ; do
echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json
echo "Publishing to primary repository: $repository" echo "Publishing to primary repository: $repository"
git push git push
elif [ $rawRepository = 'null' ]; then
echo "$branch has no repository"
else
elif [ $rawRepository != 'null' ]; then
echo "$branch is a mirror" echo "$branch is a mirror"
echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json
echo "Publishing to mirror repository: $repository" echo "Publishing to mirror repository: $repository"
@@ -19,6 +17,11 @@ for branch in $(cat package.json | jq .publishing | jq -r keys[]) ; do
git push --mirror $repository git push --mirror $repository
fi fi


rawName=$(cat package.json | jq .publishing.$branch.name)
if [ $rawName != 'null' ]; then
name=$(cat package.json | jq -r .publishing.$branch.name)
echo "$( jq --arg name "$name" '.name = $name' package.json )" > package.json
fi
registry=$(cat package.json | jq -r .publishing.$branch.publishConfig.registry) registry=$(cat package.json | jq -r .publishing.$branch.publishConfig.registry)
echo $registry echo $registry
npm publish --registry=$registry npm publish --registry=$registry


Loading…
Cancel
Save