Pārlūkot izejas kodu

Add publish script

Set up publish script to configure to multiple repositories.
master
TheoryOfNekomata pirms 4 gadiem
vecāks
revīzija
37f07a301e
2 mainītis faili ar 30 papildinājumiem un 10 dzēšanām
  1. +6
    -10
      package.json
  2. +24
    -0
      publish.sh

+ 6
- 10
package.json Parādīt failu

@@ -9,23 +9,19 @@
"src"
],
"publishing": {
"master": {
"branch": "master",
"repository": "https://code.modal.sh/TheoryOfNekomata/react-musical-keyboard.git",
"publishConfig": {
"registry": "https://js.pack.modal.sh"
}
},
"github": {
"branch": "github",
"repository": "https://github.com/Temoto-kun/react-musical-keyboard",
"publishConfig": {
"registry": "https://npm.pkg.github.com"
}
},
"npm": {
"branch": "npm",
"master": {
"repository": "https://code.modal.sh/TheoryOfNekomata/react-musical-keyboard.git",
"publishConfig": {
"registry": "https://js.pack.modal.sh"
}
},
"npm": {
"publishConfig": {
"registry": "https://registry.npmjs.com"
}


+ 24
- 0
publish.sh Parādīt failu

@@ -0,0 +1,24 @@
for branch in $(cat package.json | jq .publishing | jq -r keys[]) ; do
git checkout $branch

rawRepository=$(cat package.json | jq -r .publishing.$branch.repository)
repository=$(cat package.json | jq -r .publishing.$branch.repository)
currentRepository=$(cat package.json | jq -r .repository)

if [ $repository = $currentRepository ]; then
echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json
echo "Publishing to primary repository: $repository"
git push
elif [ $rawRepository = 'null' ]; then
echo "$branch has no repository"
else
echo "$branch is a mirror"
echo "$( jq --arg repository "$repository" '.repository = $repository' package.json )" > package.json
echo "Publishing to mirror repository: $repository"
git push --mirror $currentRepository
fi

registry=$(cat package.json | jq -r .publishing.$branch.publishConfig.registry)
echo $registry
npm publish --registry=$registry
done

Notiek ielāde…
Atcelt
Saglabāt