Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plasma-infra: Update private packages version with @auto-it #734

Merged
merged 7 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 4 additions & 42 deletions .github/actions/update-package-lock/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ inputs:
description: 'Commit message when updated package-lock'
required: false
default: 'chore: update package-locks [skip ci]'
tag:
description: 'publish tag: canary,dev,latest. For example, tag === "dev" run => npm install @salutejs/plasma-b2c@dev'
required: false
token:
description: 'A Github Token'
required: true
Expand All @@ -20,9 +17,12 @@ runs:
- name: Update package-lock's
shell: bash
run: |
# Sync package-lock file state (root level)
npm i --no-audit --no-progress --package-lock-only
# Remove the node_modules directory from all packages
lerna clean -y
lerna exec --no-private -- npm i --no-audit --no-progress --package-lock-only --ignore-scripts
# Sync package-lock files state (includes private packages)
lerna exec -- npm i --no-audit --no-progress --ignore-scripts --package-lock-only --lockfile-version 2
# root deps don't update correctly on first regeneration O_o
npm i --no-audit --no-progress --package-lock-only

Expand All @@ -39,41 +39,3 @@ runs:
branch: ${{ steps.branch_name.outputs.BRANCH }}
author_name: Salute Frontend Team
author_email: [email protected]

# [NOTE]: Временное решение.
# Как только научим plugin npm для auto изменять версии в приватных пакетах при публикации RC версии данный шаг будет удален
# Перечисленные пакеты приватные и у них нет в зависимостях приватных пакетов
# Если мы попробуем установить приватный пакет то получим ошибку
- name: Update dependencies versions in private packages by dev tag
if: ${{ inputs.tag == 'dev' }}
shell: bash
run: |
lerna_ls=$(npx lerna ls --json)
# Получаем и сохраняем версию пакета, например "@salutejs/[email protected]"
core=@salutejs/plasma-core@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-core" ) | .version')
tokens_b2b=@salutejs/plasma-tokens-b2b@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-tokens-b2b" ) | .version')
tokens_b2c=@salutejs/plasma-tokens-b2c@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-tokens-b2c" ) | .version')
tokens_web=@salutejs/plasma-tokens-web@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-tokens-web" ) | .version')
web=@salutejs/plasma-web@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-web" ) | .version')
tokens=@salutejs/plasma-tokens@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-tokens" ) | .version')
tokens_utils=@salutejs/plasma-tokens-utils@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-tokens-utils" ) | .version')
typo=@salutejs/plasma-typo@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-typo" ) | .version')
b2c=@salutejs/plasma-b2c@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-b2c" ) | .version')
icons=@salutejs/plasma-icons@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-icons" ) | .version')
colors=@salutejs/plasma-colors@$(echo $lerna_ls | jq -r -c '.[] | select( .name == "@salutejs/plasma-colors" ) | .version')

npm i $core $tokens_b2b $web --no-audit --no-progress --save-exact --prefix="./utils/plasma-docs-ui"
npm i $tokens $tokens_utils $typo --no-audit --no-progress --save-exact --prefix="./utils/plasma-tokens-native"
npm i $b2c $icons $tokens_b2c $typo --no-audit --no-progress --save-exact --legacy-peer-deps --prefix="./website/plasma-website"
npm i $b2c $colors $icons $tokens_b2b $tokens_b2c $tokens_utils $tokens_web $typo --no-audit --no-progress --save-exact --prefix="./website/plasma-theme-builder"

# [NOTE]: Временное решение.
- name: Commit & Push changes files
if: ${{ inputs.tag == 'dev' }}
uses: actions-js/push@master
with:
github_token: ${{ inputs.token }}
message: "Update versions"
branch: ${{ steps.branch_name.outputs.BRANCH }}
author_name: Salute Frontend Team
author_email: [email protected]
5 changes: 1 addition & 4 deletions .github/processing-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ module.exports = () => {
const HAS_PLASMA_UI_DOCS = packagesList.includes('@salutejs/plasma-ui-docs');
const HAS_PLASMA_WEB_DOCS = packagesList.includes('@salutejs/plasma-web-docs');
const HAS_PLASMA_TEMPLE_DOCS = packagesList.includes('@salutejs/plasma-temple-docs');
const HAS_PLASMA_WEBSITE = packagesList.includes('@salutejs/plasma-website');

const HAS_PLASMA_UI = packagesList.includes('@salutejs/plasma-ui');
const HAS_PLASMA_WEB = packagesList.includes('@salutejs/plasma-web');
const HAS_PLASMA_B2C = packagesList.includes('@salutejs/plasma-b2c');
const HAS_PLASMA_TEMPLE = packagesList.includes('@salutejs/plasma-temple');

const HAS_DOCUMENTATION_CHANGED =
HAS_PLASMA_UI_DOCS || HAS_PLASMA_WEB_DOCS || HAS_PLASMA_TEMPLE_DOCS || HAS_PLASMA_WEBSITE;
const HAS_DOCUMENTATION_CHANGED = HAS_PLASMA_UI_DOCS || HAS_PLASMA_WEB_DOCS || HAS_PLASMA_TEMPLE_DOCS;

/**
* List short packages name
Expand All @@ -70,7 +68,6 @@ module.exports = () => {
HAS_PLASMA_UI_DOCS,
HAS_PLASMA_WEB_DOCS,
HAS_PLASMA_TEMPLE_DOCS,
HAS_PLASMA_WEBSITE,
HAS_PLASMA_UI,
HAS_PLASMA_WEB,
HAS_PLASMA_B2C,
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/change-detection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ on:
HAS_PLASMA_TEMPLE_DOCS:
description: ""
value: ${{ jobs.run.outputs.HAS_PLASMA_TEMPLE_DOCS }}
HAS_PLASMA_WEBSITE:
description: ""
value: ${{ jobs.run.outputs.HAS_PLASMA_WEBSITE }}
HAS_PLASMA_UI:
description: ""
value: ${{ jobs.run.outputs.HAS_PLASMA_UI }}
Expand All @@ -58,7 +55,6 @@ jobs:
HAS_PLASMA_UI_DOCS: ${{ steps.set-output.outputs.HAS_PLASMA_UI_DOCS }}
HAS_PLASMA_WEB_DOCS: ${{ steps.set-output.outputs.HAS_PLASMA_WEB_DOCS }}
HAS_PLASMA_TEMPLE_DOCS: ${{ steps.set-output.outputs.HAS_PLASMA_TEMPLE_DOCS }}
HAS_PLASMA_WEBSITE: ${{ steps.set-output.outputs.HAS_PLASMA_WEBSITE }}
HAS_PLASMA_TEMPLE: ${{ steps.set-output.outputs.HAS_PLASMA_TEMPLE }}
HAS_PLASMA_B2C: ${{ steps.set-output.outputs.HAS_PLASMA_B2C }}
HAS_PLASMA_WEB: ${{ steps.set-output.outputs.HAS_PLASMA_WEB }}
Expand Down Expand Up @@ -104,7 +100,6 @@ jobs:
echo "HAS_PLASMA_UI_DOCS=${{ fromJSON(steps.scope.outputs.result).HAS_PLASMA_UI_DOCS }}" >> $GITHUB_OUTPUT
echo "HAS_PLASMA_WEB_DOCS=${{ fromJSON(steps.scope.outputs.result).HAS_PLASMA_WEB_DOCS }}" >> $GITHUB_OUTPUT
echo "HAS_PLASMA_TEMPLE_DOCS=${{ fromJSON(steps.scope.outputs.result).HAS_PLASMA_TEMPLE_DOCS }}" >> $GITHUB_OUTPUT
echo "HAS_PLASMA_WEBSITE=${{ fromJSON(steps.scope.outputs.result).HAS_PLASMA_WEBSITE }}" >> $GITHUB_OUTPUT
echo "HAS_DOCUMENTATION_CHANGED=${{ fromJSON(steps.scope.outputs.result).HAS_DOCUMENTATION_CHANGED }}" >> $GITHUB_OUTPUT
echo "HAS_PLASMA_TEMPLE=${{ fromJSON(steps.scope.outputs.result).HAS_PLASMA_TEMPLE }}" >> $GITHUB_OUTPUT
echo "HAS_PLASMA_B2C=${{ fromJSON(steps.scope.outputs.result).HAS_PLASMA_B2C }}" >> $GITHUB_OUTPUT
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/documentation-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ jobs:

# TODO: https://github.com/salute-developers/plasma/issues/603
- name: Plasma Website
if: ${{ needs.scope.outputs.HAS_PLASMA_WEBSITE == 'true' }}
run: |
export NODE_OPTIONS=--openssl-legacy-provider
npm run build --prefix="./website/plasma-website"
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/publish-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
commit-message:
type: string
default: 'chore: update package-locks [skip ci]'
tag:
type: string
description: 'publish tag: canary,dev,latest. For example, tag === "dev" run => npm install @salutejs/plasma-b2c@dev'
secrets:
gh_token:
required: true
Expand Down Expand Up @@ -58,5 +55,4 @@ jobs:
uses: ./.github/actions/update-package-lock
with:
commit-message: ${{ inputs.commit-message }}
tag: ${{ inputs.tag }}
token: ${{ secrets.gh_token }}
1 change: 0 additions & 1 deletion .github/workflows/publish-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
with:
with-update-package-lock: true
commit-message: "chore: update package-locks"
tag: "dev"
secrets:
gh_token: ${{ secrets.GH_TOKEN }}
npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }}
Expand Down
Loading
Loading