patch: pr7878 • patch/pr7878 • 11682614780 #3927
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: 'Pull Request / Packages: Deploy' | |
# Note: display_title не задокументирован | |
run-name: '${{ github.event.workflow_run.display_title }} • ${{ github.event.workflow_run.head_branch }} • ${{ github.event.workflow_run.id }}' | |
on: | |
workflow_run: | |
workflows: ['Pull Request / Packages'] | |
types: [completed] | |
env: | |
PR_HEAD_REPOSITORY_FULL_NAME: ${{ github.event.workflow_run.head_repository.full_name }} | |
PR_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} | |
PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | |
AWS_S3_URL: https://${{ vars.AWS_BUCKET }}.${{ vars.AWS_ENDPOINT }} | |
jobs: | |
pr_workflow_payload: | |
if: ${{ github.event.workflow_run.event == 'pull_request' }} | |
name: Call reusable workflow | |
uses: ./.github/workflows/reusable_workflow_pr_worfklow_payload.yml | |
with: | |
action: download | |
deploy_test_coverage: | |
needs: pr_workflow_payload | |
if: ${{ needs.pr_workflow_payload.outputs.status == 'success' }} | |
runs-on: ubuntu-latest | |
name: Deploy test coverage | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.PR_HEAD_REPOSITORY_FULL_NAME }} | |
ref: ${{ env.PR_HEAD_BRANCH }} | |
persist-credentials: false | |
- name: Download artifact | |
id: artifact | |
uses: VKCOM/gh-actions/shared/download-workflow-artifact@main | |
with: | |
name: test-output | |
- name: Upload coverage to Codecov | |
if: ${{ steps.artifact.outputs.found_artifact == 'true' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unittests | |
files: .nyc_output/coverage-final.json | |
override_branch: ${{ env.PR_HEAD_BRANCH }} | |
override_commit: ${{ env.PR_HEAD_SHA }} | |
override_pr: ${{ needs.pr_workflow_payload.outputs.pr_number }} | |
fail_ci_if_error: true | |
verbose: true | |
deploy_playwright_report: | |
needs: pr_workflow_payload | |
if: ${{ needs.pr_workflow_payload.outputs.status == 'success' }} | |
runs-on: ubuntu-latest | |
name: Deploy Playwright Report and create comment | |
steps: | |
- name: Download artifact | |
id: artifact | |
uses: VKCOM/gh-actions/shared/download-workflow-artifact@main | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
- name: Deploy Playwright Report | |
if: ${{ steps.artifact.outputs.found_artifact == 'true' }} | |
id: deploy | |
uses: VKCOM/gh-actions/VKUI/s3@main | |
with: | |
awsAccessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
awsSecretAccessKey: ${{ secrets.AWS_SECRET_KEY }} | |
awsBucket: ${{ vars.AWS_BUCKET }} | |
awsEndpoint: https://${{ vars.AWS_ENDPOINT }} | |
command: upload | |
commandUploadSrc: playwright-report/ | |
commandUploadDist: pull/${{ needs.pr_workflow_payload.outputs.pr_number }}/${{ env.PR_HEAD_SHA }}/playwright-report | |
- name: Report | |
if: ${{ steps.deploy.outcome == 'success' }} | |
uses: VKCOM/gh-actions/VKUI/reporter@main | |
with: | |
prNumber: ${{ needs.pr_workflow_payload.outputs.pr_number }} | |
playwrightReportURL: ${{ env.AWS_S3_URL }}/pull/${{ needs.pr_workflow_payload.outputs.pr_number }}/${{ env.PR_HEAD_SHA }}/playwright-report/index.html | |
token: ${{ secrets.GITHUB_TOKEN }} | |
deploy_styleguide: | |
needs: pr_workflow_payload | |
if: ${{ needs.pr_workflow_payload.outputs.status == 'success' }} | |
runs-on: ubuntu-latest | |
name: Deploy docs (styleguide) | |
outputs: | |
url: ${{ steps.url.outputs.value }} | |
steps: | |
- name: Download styleguide dist artifact | |
id: artifact | |
uses: VKCOM/gh-actions/shared/download-workflow-artifact@main | |
with: | |
name: styleguide-dist | |
path: styleguide-dist/ | |
- name: Upload styleguide S3 | |
if: ${{ steps.artifact.outputs.found_artifact == 'true' }} | |
id: deploy | |
uses: VKCOM/gh-actions/VKUI/s3@main | |
with: | |
awsAccessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
awsSecretAccessKey: ${{ secrets.AWS_SECRET_KEY }} | |
awsBucket: ${{ vars.AWS_BUCKET }} | |
awsEndpoint: https://${{ vars.AWS_ENDPOINT }} | |
command: upload | |
commandUploadSrc: styleguide-dist/ | |
commandUploadDist: pull/${{ needs.pr_workflow_payload.outputs.pr_number }}/${{ env.PR_HEAD_SHA }}/styleguide | |
- name: Create doc url | |
if: ${{ steps.deploy.outcome == 'success' }} | |
id: url | |
run: echo "value=${{ env.AWS_S3_URL }}/pull/${{ needs.pr_workflow_payload.outputs.pr_number }}/${{ env.PR_HEAD_SHA }}/styleguide/index.html" >> $GITHUB_OUTPUT | |
deploy_storybook: | |
needs: pr_workflow_payload | |
if: ${{ needs.pr_workflow_payload.outputs.status == 'success' }} | |
runs-on: ubuntu-latest | |
name: Deploy docs (storybook) | |
outputs: | |
url: ${{ steps.url.outputs.value }} | |
steps: | |
- name: Download dist artifact | |
id: artifact | |
uses: VKCOM/gh-actions/shared/download-workflow-artifact@main | |
with: | |
name: storybook-dist | |
path: storybook-dist/ | |
- name: Upload | |
if: ${{ steps.artifact.outputs.found_artifact == 'true' }} | |
id: deploy | |
uses: VKCOM/gh-actions/VKUI/s3@main | |
with: | |
awsAccessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
awsSecretAccessKey: ${{ secrets.AWS_SECRET_KEY }} | |
awsBucket: ${{ vars.AWS_BUCKET }} | |
awsEndpoint: https://${{ vars.AWS_ENDPOINT }} | |
command: upload | |
commandUploadSrc: storybook-dist/ | |
commandUploadDist: pull/${{ needs.pr_workflow_payload.outputs.pr_number }}/${{ env.PR_HEAD_SHA }}/storybook | |
- name: Create doc url | |
if: ${{ steps.deploy.outcome == 'success' }} | |
id: url | |
run: echo "value=${{ env.AWS_S3_URL }}/pull/${{ needs.pr_workflow_payload.outputs.pr_number }}/${{ env.PR_HEAD_SHA }}/storybook/index.html" >> $GITHUB_OUTPUT | |
docs_comment: | |
needs: | |
- deploy_storybook | |
- deploy_styleguide | |
- pr_workflow_payload | |
if: ${{ needs.deploy_styleguide.outputs.url != '' || needs.deploy_storybook.outputs.url != '' }} | |
runs-on: ubuntu-latest | |
name: Docs comment | |
steps: | |
- name: Find docs URLs comment | |
uses: peter-evans/find-comment@v3 | |
id: find_url_comment | |
with: | |
issue-number: ${{ needs.pr_workflow_payload.outputs.pr_number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: <!-- docs_urls --> | |
- name: Create or update comment | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
comment-id: ${{ steps.find_url_comment.outputs.comment-id }} | |
issue-number: ${{ needs.pr_workflow_payload.outputs.pr_number }} | |
body: | | |
<!-- docs_urls --> | |
## 👀 Docs deployed | |
- ${{ (needs.deploy_styleguide.outputs.url != '' && '✅') || '❌' }} [Styleguide](${{ needs.deploy_styleguide.outputs.url }}) | |
- ${{ (needs.deploy_storybook.outputs.url != '' && '✅') || '❌' }} [Storybook](${{ needs.deploy_storybook.outputs.url }}) | |
Commit ${{ env.PR_HEAD_SHA }} | |
edit-mode: replace |