Skip to content

Commit

Permalink
test: cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Aug 22, 2022
1 parent 1cdde8b commit 8cf4507
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 40 deletions.
17 changes: 0 additions & 17 deletions .github/actions/auth-with-registry/action.yml

This file was deleted.

16 changes: 13 additions & 3 deletions .github/scripts/build-gh-page.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
echo "➕ Create temp or public dir: $NAME"
if [[ $RELEASE == "true" ]]; then
mkdir temp
echo "Created 'temp' dir"
echo " Created 'temp' dir"
else
mkdir public
echo "Created 'public' dir"
echo " Created 'public' dir"
fi


Expand All @@ -20,25 +20,35 @@ else
tar -zxf gh-pages -C public --strip-components 1
fi

echo "📁 Move ./out folder to public"
echo "📁 Bundle public"
if [[ $RELEASE == "true" ]]; then
echo " Move ./out ./public"
mv ./out ./public
if [ -d ./temp/review ]; then
echo " Move ./temp/review ./public"
mv ./temp/review ./public
fi
if [ -d ./temp/version ]; then
echo " Move ./temp/version ./public"
mv ./temp/version ./public
fi
elif [[ $PRE_RELEASE == "true" ]]; then
if [[ ! -d ./public/version ]]; then
echo " Make dir ./public/version"
mkdir ./public/version
fi
if [[ -d ./public/version/"$NAME" ]]; then
echo " Remove dir ./public/version/$NAME"
rm -rf ./public/version/"$NAME"
fi
mv ./out ./public/version/"$NAME"
else
if [[ ! -d ./public/review ]]; then
echo " Make dir ./public/review"
mkdir ./public/review
fi
if [[ -d ./public/review/"$NAME" ]]; then
echo " Remove dir ./public/review/$NAME"
rm -rf ./public/review/"$NAME"
fi
mv ./out ./public/review/"$NAME"
Expand Down
35 changes: 20 additions & 15 deletions .github/scripts/publish-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ if [[ $RELEASE == 'false' && $PRE_RELEASE == 'false' ]]; then
fi

echo "🛠 Forge all packages version numbers"
echo "which package verison ?: $VALID_SEMVER_VERSION"
echo "which package version ?: $VALID_SEMVER_VERSION"

npm version --no-git-tag-version "$VALID_SEMVER_VERSION" --workspace=@db-ui/elements
npm version --no-git-tag-version "$VALID_SEMVER_VERSION" --workspace=@db-ui/ngx-elements
npm version --no-git-tag-version "$VALID_SEMVER_VERSION" --workspace=@db-ui/react-elements
npm version --no-git-tag-version "$VALID_SEMVER_VERSION" --workspace=@db-ui/v-elements

npm pkg set dependencies.@db-ui/elements="$VALID_SEMVER_VERSION" --workspace=@db-ui/ngx-elements
npm pkg set dependencies.@db-ui/elements="$VALID_SEMVER_VERSION" --workspace=@db-ui/react-elements
npm pkg set dependencies.@db-ui/elements="$VALID_SEMVER_VERSION" --workspace=@db-ui/v-elements
npm pkg set dependencies.@db-ui/elements"$PACKAGE_ENDING"="$VALID_SEMVER_VERSION" --workspace=@db-ui/ngx-elements
npm pkg set dependencies.@db-ui/elements"$PACKAGE_ENDING"="$VALID_SEMVER_VERSION" --workspace=@db-ui/react-elements
npm pkg set dependencies.@db-ui/elements"$PACKAGE_ENDING"="$VALID_SEMVER_VERSION" --workspace=@db-ui/v-elements

if [[ $DBUI_THEME != 'default' ]]; then
echo "Forge $DBUI_THEME string replacement..."
Expand All @@ -30,12 +30,6 @@ if [[ $DBUI_THEME != 'default' ]]; then
npx -y replace-in-file @db-ui/v-elements @db-ui/v-elements"$PACKAGE_ENDING" 'packages/**/*.*'
fi

echo "🔑 Authenticate with NPM Registry"
npm config set registry https://npm.pkg.github.com
npm set //npm.pkg.github.com/:_authToken "$GPR_TOKEN"
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN"


echo "📦 Create packages"
npm pack --workspace=@db-ui/elements"$PACKAGE_ENDING"
npm pack --workspace=@db-ui/ngx-elements"$PACKAGE_ENDING"
Expand All @@ -47,8 +41,19 @@ if [[ $PRE_RELEASE == 'true' ]]; then
NEXT="--tag next"
fi

echo "📰 Publish Package to Registry (--dry-run $NEXT)"
npm publish db-ui-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --dry-run "$NEXT"
npm publish db-ui-ngx-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --dry-run "$NEXT"
npm publish db-ui-react-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --dry-run "$NEXT"
npm publish db-ui-v-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --dry-run "$NEXT"
echo "📰 Publish Package to Registry ($NEXT)"
for REGISTRY in NPM GITHUB;
do
echo "🔑 Authenticate $REGISTRY NPM Registry"
if [[ $REGISTRY == 'NPM' ]]; then
npm config set registry https://registry.npmjs.org/
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
elif [[ $REGISTRY == 'GITHUB' ]]; then
npm config set registry https://npm.pkg.github.com
npm set //npm.pkg.github.com/:_authToken "$GPR_TOKEN"
fi
npm publish db-ui-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --quiet "$NEXT"
npm publish db-ui-ngx-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --quiet "$NEXT"
npm publish db-ui-react-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --quiet "$NEXT"
npm publish db-ui-v-elements"$PACKAGE_ENDING"-"$VALID_SEMVER_VERSION".tgz --quiet "$NEXT"
done
4 changes: 2 additions & 2 deletions .github/workflows/03-deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ jobs:
PRE_RELEASE: ${{ inputs.preRelease }}
NAME: ${{ steps.extract.outputs.name }}
run: |
if [ $RELEASE == "true" ]
if [[ $RELEASE == "true" ]];
then
export URL=https://db-ui.github.io/elements
elif [ $PRE_RELEASE == "true" ];
elif [[ $PRE_RELEASE == "true" ]];
then
export URL=https://db-ui.github.io/elements/version/${NAME}
else
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
"lint:markdownlint": "markdownlint -c .markdown-lint.yml **/*.md",
"lint:stylelint": "stylelint **/*.scss",
"lint:eslint": "eslint . --ext .ts,.js --ignore-path .gitignore --ignore-path .eslintignore && npm run lint --workspace=@db-ui/elements",
"generate": "npm run generate --workspace=@db-ui/elements",
"postpublish": "npm run publish-npm",
"publish-npm": "npm publish --access public --ignore-scripts --@OWNER:registry='https://registry.npmjs.org'"
"generate": "npm run generate --workspace=@db-ui/elements"
},
"workspaces": [
"packages/*"
Expand Down

0 comments on commit 8cf4507

Please sign in to comment.