feat: add sideeffects; part 5 #6700
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: Demo build | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Demo build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
fetch-depth: 3 | |
- name: Set PR head SHA | |
run: | | |
if [ "${{ github.event.pull_request.head.sha }}" != '' ]; | |
then | |
echo "PR_LAST_COMMIT_SHA=$(echo "${{ github.event.pull_request.head.sha }}")" >> $GITHUB_ENV | |
fi | |
- name: Install dependencies | |
run: yarn | |
- name: Run lint | |
run: yarn lint | |
- name: Run build | |
id: demo_build | |
run: node ./bin/demo-build.js | |
- name: Publish storybook | |
run: | | |
cd ./storybook-demo | |
git push -q -f "https://core-ds-bot:${{ secrets.BOT_AUTH_TOKEN }}@github.com/core-ds/core-components.git" master:gh-pages | |
# Ищем открытый PR | |
- name: Find open PR | |
uses: jwalton/gh-find-current-pr@v1 | |
id: find_pr | |
with: | |
github-token: ${{ secrets.BOT_AUTH_TOKEN }} | |
# Если нашли открытый PR, то добавляем коммент с ссылкой на демку. | |
# storybook_url заполняется в demo-build.js | |
- name: Create comment | |
if: success() && steps.find_pr.outputs.number | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
token: ${{ secrets.BOT_AUTH_TOKEN }} | |
issue-number: ${{ steps.find_pr.outputs.pr }} | |
body: | | |
Собрана новая [демка](${{ steps.demo_build.outputs.storybook_url }}). | |
reactions: 'rocket' |