Skip to content

feat(plasma-*,sdds-*): Validation for email and password #2380

feat(plasma-*,sdds-*): Validation for email and password

feat(plasma-*,sdds-*): Validation for email and password #2380

name: Deploy documentations artefacts [PR]
on:
pull_request_target:
branches:
- dev
pull_request:
branches:
- master
concurrency:
# New commit on branch cancels running workflows of the same branch
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
authorize:
name: Authorize external pull request
if: ${{ !startsWith(github.head_ref, 'release') }}
uses: ./.github/workflows/authorize-external-pr.yml
state:
name: Handle lerna changed state
needs: [authorize]
uses: ./.github/workflows/change-detection.yml
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
secrets: inherit
deploy-website:
name: Deploy website artifacts
needs: [ state ]
if: ${{ fromJSON(needs.state.outputs.STATE).HAS_DEPLOY_WEBSITE }}
runs-on: ubuntu-22.04
env:
PR_NAME: pr-${{ github.event.number }}
PREFIX: pr/pr-${{ github.event.number }}
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
show-progress: false
- name: Prepare environment
uses: ./.github/actions/prepare-environment
- name: Get lerna scope
id: lerna-scope
uses: actions/github-script@v7
env:
PROCESSED_DATA: ${{ toJSON(fromJson(needs.state.outputs.STATE).PROCESSED_DATA) }}
with:
result-encoding: string
script: |
const { PROCESSED_DATA } = process.env;
const processedData = JSON.parse(PROCESSED_DATA);
const requiredPackages = [
'plasma-b2c',
'plasma-tokens-b2c',
'plasma-typo'
];
// TODO: логика под рефакторинг под использование object
const result = [
...processedData.filter((package) => requiredPackages.includes(package)),
'plasma-website',
'plasma-icons',
];
// INFO: Пока не починили медленный css build for b2c/web ставим plasma-new-hope
if (processedData.includes('plasma-b2c')) {
result.push('plasma-new-hope');
result.push('plasma-themes');
result.push('core-themes');
}
return `@salutejs/{${result.join(',')}}`;
- name: Lerna bootstrap
run: npx lerna bootstrap --scope="${{ steps.lerna-scope.outputs.result }}"
- name: Prepare directory
run: |
mkdir -p s3_build/${PR_NAME}
# TODO: https://github.com/salute-developers/plasma/issues/603
- name: Plasma Website
run: |
export NODE_OPTIONS=--openssl-legacy-provider
npm run build --prefix="./website/plasma-website"
cp -R ./website/plasma-website/build/. ./s3_build/${PR_NAME}
- name: Install s3cmd
run: pip3 install s3cmd
- name: s3 Upload
run: >
s3cmd
--access_key ${{ secrets.AWS_ACCESS_KEY_ID }}
--secret_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
--host ${{ secrets.AWS_ENDPOINT }}
--host-bucket ${{ secrets.AWS_ENDPOINT }}
--bucket-location ${{ secrets.AWS_REGION }}
--signature-v2
--no-mime-magic
sync
./s3_build/${PR_NAME}/
s3://${{ secrets.AWS_S3_BUCKET_2 }}/pr/${PR_NAME}/
deploy-artifacts:
name: Deploy artifacts
needs: [ state, deploy-website ]
if: ${{ fromJSON(needs.state.outputs.STATE).HAS_PACKAGES_DS_CHANGES }}
runs-on: ubuntu-22.04
env:
PR_NAME: pr-${{ github.event.number }}
PREFIX: pr/pr-${{ github.event.number }}
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.state.outputs.STATE).PACKAGES_DOCUMENTATIONS_RUN }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
ref: refs/pull/${{github.event.pull_request.number}}/merge
- name: Prepare environment
uses: ./.github/actions/prepare-environment
- name: Set job environment variables
run: |
echo "SHORT_NAME=$(echo ${{ matrix.package }} | sed -r 's/plasma-//g')" >> $GITHUB_ENV
echo "HAS_PACKAGE_DOCS=$([ -d "./website/${{ matrix.package }}-docs" ] && echo true || echo false)" >> $GITHUB_ENV
- name: Get lerna scope
id: lerna-scope
uses: actions/github-script@v7
env:
PROCESSED_DATA: ${{ toJSON(fromJson(needs.state.outputs.STATE).PROCESSED_DATA) }}
PACKAGE: ${{ matrix.package }}
with:
result-encoding: string
script: |
const getLernaScope = require('./.github/get-lerna-scope.js');
return getLernaScope();
- name: Lerna bootstrap
run: npx lerna bootstrap --scope="${{ steps.lerna-scope.outputs.result }}"
- name: Prepare directory
run: mkdir -p s3_build/${PR_NAME}
- name: Build documentation - "${{ matrix.package }}"
if: ${{ fromJSON(env.HAS_PACKAGE_DOCS) }}
run: |
npm run build --prefix="./website/${{ matrix.package }}-docs" -- --no-minify
cp -R ./website/${{ matrix.package }}-docs/build ./s3_build/${PR_NAME}/${{ env.SHORT_NAME }}
- name: Build storybook - "${{ matrix.package }}"
run: |
npm run storybook:build --prefix="./packages/${{ matrix.package }}"
cp -R ./packages/${{ matrix.package }}/build-sb ./s3_build/${PR_NAME}/${{ env.SHORT_NAME }}-storybook
- name: Build storybook by draft components - "${{ matrix.package }}"
if: false
run: |
npm run storybook:build:draft --prefix="./packages/${{ matrix.package }}"
cp -R ./packages/${{ matrix.package }}/build-sb-draft ./s3_build/${PR_NAME}/${{ env.SHORT_NAME }}-draft-storybook
- name: Install s3cmd
run: pip3 install s3cmd
- name: s3 upload docs
if: ${{ fromJSON(env.HAS_PACKAGE_DOCS) }}
run: >
s3cmd
--access_key ${{ secrets.AWS_ACCESS_KEY_ID }}
--secret_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
--host ${{ secrets.AWS_ENDPOINT }}
--host-bucket ${{ secrets.AWS_ENDPOINT }}
--bucket-location ${{ secrets.AWS_REGION }}
--signature-v2
--delete-removed
--no-mime-magic
sync
./s3_build/${PR_NAME}/${{ env.SHORT_NAME }}/
s3://${{ secrets.AWS_S3_BUCKET_2 }}/pr/${PR_NAME}/${{ env.SHORT_NAME }}/
- name: s3 upload storybook by draft components
if: false
run: >
s3cmd
--access_key ${{ secrets.AWS_ACCESS_KEY_ID }}
--secret_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
--host ${{ secrets.AWS_ENDPOINT }}
--host-bucket ${{ secrets.AWS_ENDPOINT }}
--bucket-location ${{ secrets.AWS_REGION }}
--signature-v2
--delete-removed
--no-mime-magic
sync
./s3_build/${PR_NAME}/${{ env.SHORT_NAME }}-draft-storybook/
s3://${{ secrets.AWS_S3_BUCKET_2 }}/pr/${PR_NAME}/${{ env.SHORT_NAME }}-draft-storybook/
- name: s3 upload storybook
run: >
s3cmd
--access_key ${{ secrets.AWS_ACCESS_KEY_ID }}
--secret_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
--host ${{ secrets.AWS_ENDPOINT }}
--host-bucket ${{ secrets.AWS_ENDPOINT }}
--bucket-location ${{ secrets.AWS_REGION }}
--signature-v2
--delete-removed
--no-mime-magic
sync
./s3_build/${PR_NAME}/${{ env.SHORT_NAME }}-storybook/
s3://${{ secrets.AWS_S3_BUCKET_2 }}/pr/${PR_NAME}/${{ env.SHORT_NAME }}-storybook/
attache-comment:
name: Attached comment
needs: [ state, deploy-website, deploy-artifacts ]
if: ${{ always() && (contains(needs.deploy-website.result, 'success') || contains(needs.deploy-artifacts.result, 'success')) }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
show-progress: false
- name: Create comment
id: comment-link
uses: actions/github-script@v7
env:
PACKAGES_DS: ${{ toJSON(fromJSON(needs.state.outputs.STATE).PACKAGES_DOCUMENTATIONS_RUN) }}
BASE_URL: ${{ vars.STAGE_STABLE_URL }}/pr/pr-${{ github.event.number }}
with:
result-encoding: string
script: |
const createLinks = require('./.github/create-links.js');
return createLinks();
- name: Attach comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Links
message: ${{ steps.comment-link.outputs.result }}