feat(plasma-new-hope): Dropzone #5460
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR theme-builder | |
on: | |
pull_request: | |
branches: | |
- master | |
pull_request_target: | |
branches: | |
- dev | |
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 | |
uses: ./.github/workflows/authorize-external-pr.yml | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
needs: authorize | |
env: | |
PR_NAME: pr-${{ github.event.number }} | |
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: Prepare directory for build | |
run: mkdir s3_build | |
# TODO: https://github.com/salute-developers/plasma/issues/255 | |
- name: Lerna bootstrap with scope | |
run: | | |
npx lerna bootstrap --scope @salutejs/plasma-theme-builder --scope=@salutejs/plasma-{tokens,tokens-utils} | |
# TODO: https://github.com/salute-developers/plasma/issues/603 | |
- name: Build Theme Builder | |
env: | |
REACT_APP_APPLICATION_CLIENT_ID: ${{ secrets.REACT_APP_APPLICATION_CLIENT_ID }} | |
REACT_APP_AUTH_SERVER_URL: ${{ secrets.REACT_APP_AUTH_SERVER_URL }} | |
run: | | |
export NODE_OPTIONS=--openssl-legacy-provider | |
npm run build --prefix="./website/plasma-theme-builder" | |
cp -R ./website/plasma-theme-builder/build ./s3_build/plasma-theme-builder-${PR_NAME} | |
- name: Install s3cmd | |
run: | | |
pip3 install s3cmd | |
- name: s3 Upload build | |
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/plasma-theme-builder-${PR_NAME}/ | |
s3://${{ secrets.AWS_S3_BUCKET_2 }}/pr/plasma-theme-builder-${PR_NAME}/ | |
- name: Create success comment | |
id: success-comment | |
uses: actions/github-script@v3 | |
with: | |
result-encoding: string | |
script: | | |
const branchName = context.payload.pull_request.head.ref; | |
const themeName = branchName.split('theme-builder-')[1]; | |
const params = themeName ? `?theme=${themeName}&branch=${branchName}` : ''; | |
const url = `${{ vars.STAGE_STABLE_URL }}/pr/plasma-theme-builder-pr-${context.issue.number}/${params}` | |
return "Theme Builder app deployed!" + "\n\n" + url; | |
- name: Attach comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: Theme Builder | |
message: ${{ steps.success-comment.outputs.result }} |