diff --git a/.github/actions/auth-with-registry/action.yml b/.github/actions/auth-with-registry/action.yml deleted file mode 100644 index a9bee9faf3..0000000000 --- a/.github/actions/auth-with-registry/action.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Authenticate with Registry -description: 'Authenticate with registry for publishing packages' -inputs: - registry: - description: 'Registry URL' - required: true -runs: - using: 'composite' - steps: - - name: Authenticate with Registry - run: | - touch .npmrc - echo "registry=https:${{ inputs.registry }}" >> .npmrc - echo "${{ inputs.registry }}:_authToken=$NPM_TOKEN" >> .npmrc - echo "registry=https:${{ inputs.registry }}" - shell: bash diff --git a/.github/scripts/build-gh-page.sh b/.github/scripts/build-gh-page.sh index f430655960..23ecd14fb4 100644 --- a/.github/scripts/build-gh-page.sh +++ b/.github/scripts/build-gh-page.sh @@ -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 @@ -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" diff --git a/.github/scripts/publish-npm.sh b/.github/scripts/publish-npm.sh index ccd577da2e..519d70d13e 100644 --- a/.github/scripts/publish-npm.sh +++ b/.github/scripts/publish-npm.sh @@ -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..." @@ -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" @@ -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 diff --git a/.github/workflows/03-deploy-gh-pages.yml b/.github/workflows/03-deploy-gh-pages.yml index fcf0c002dc..526d664bec 100644 --- a/.github/workflows/03-deploy-gh-pages.yml +++ b/.github/workflows/03-deploy-gh-pages.yml @@ -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 diff --git a/package.json b/package.json index 3eeaf1cc95..46314ea2b4 100644 --- a/package.json +++ b/package.json @@ -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/*"