Добавляет ответ про aria атрибуты #6041
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 Preview | |
on: | |
pull_request_target: | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
files: ${{ steps.files.outputs.all }} | |
steps: | |
- name: Выборка файлов для формирования списка | |
id: files | |
run: | | |
pr_files=$(echo $(curl \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files)) | |
list=$(echo $pr_files | grep -o '"filename": "[^"]*' | cut -d'"' -f4) | |
mdReplaced=${list//md/html} | |
returnReplaced=${list//$"\n"/ } | |
echo "::set-output name=all::$returnReplaced" | |
echo $returnReplaced | |
pr-preview: | |
runs-on: ubuntu-latest | |
needs: | |
- prepare | |
env: | |
DEPLOY_DOMAIN: https://content-${{ github.event.pull_request.number }}.dev.doka.guide | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PATH_TO_CONTENT: ./content | |
steps: | |
- name: Загрузка platform | |
uses: actions/checkout@v3 | |
with: | |
repository: doka-guide/platform | |
- name: Загрузка контента | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: content | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Кэширование модулей | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Получение идентификатора | |
id: check | |
run: | | |
check_suite_url=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq -r '.check_suite_url') | |
check_run_id=$(curl -s -H "Accept: application/vnd.github.v3+json" $check_suite_url/check-runs | jq '.check_runs[] | .id') | |
echo "::set-output name=check_id::$check_run_id" | |
- name: Установка модулей | |
run: npm ci | |
- name: Сообщение о начале публикации превью | |
uses: hasura/comment-progress@v2.1.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.pull_request.number }} | |
id: preview-${{ github.event.pull_request.number }} | |
message: "Идёт сборка и публикация превью... [Подробнее](https://github.com/${{ github.repository }}/runs/${{ steps.check.outputs.check_id }}?check_suite_focus=true)" | |
recreate: true | |
- name: Форматирование списка файлов | |
id: links | |
run: | | |
file_list="" | |
for f in ${{ needs.prepare.outputs.files }}; do | |
if [[ $changed_file =~ ".html" ]]; then | |
file_list=$(echo -e "${file_list}<li><a href="${{ env.DEPLOY_DOMAIN }}/${f}">${f}</a></li>") | |
fi | |
done | |
if ! [[ $file_list == "" ]]; then | |
file_list=$(echo -e "<br><p>Список изменённых материалов:<ul>${file_list}</ul><p>") | |
fi | |
echo ::set-output name=list::$(echo -e "${file_list}") | |
- name: Установка ключа для пользователя | |
run: | | |
set -eu | |
mkdir "$HOME/.ssh" | |
echo "${{ secrets.DEPLOY_KEY }}" > "$HOME/.ssh/doka_deploy" | |
chmod 600 "$HOME/.ssh/doka_deploy" | |
- name: Сборка и публикация сайта | |
id: build-preview | |
continue-on-error: true | |
run: | | |
cp .env.example .env | |
npm run preview | |
ssh -i $HOME/.ssh/doka_deploy -o StrictHostKeyChecking=no deploy@dev.doka.guide mkdir -p /web/sites/dev.doka.guide/content/${{ github.event.pull_request.number }} | |
cd dist && rsync -e "ssh -i $HOME/.ssh/doka_deploy -o StrictHostKeyChecking=no" --archive --progress --compress --delete . deploy@dev.doka.guide:/web/sites/dev.doka.guide/content/${{ github.event.pull_request.number }} | |
echo "Ссылка на превью — ${{ env.DEPLOY_DOMAIN }}" | |
echo -e "${{ steps.links.outputs.list }}" | |
- name: Сообщение о неудаче публикации превью | |
uses: hasura/comment-progress@v2.1.0 | |
if: failure() | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.pull_request.number }} | |
id: preview-${{ github.event.pull_request.number }} | |
message: "Превью контента из ${{ github.event.after }} не опубликовано. Ошибка сборки или публикации. [Подробнее](https://github.com/${{ github.repository }}/runs/${{ steps.check.outputs.check_id }}?check_suite_focus=true)" | |
fail: true | |
recreate: true | |
- name: Сообщение об успехе публикации превью | |
uses: hasura/comment-progress@v2.1.0 | |
if: success() | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.pull_request.number }} | |
id: preview-${{ github.event.pull_request.number }} | |
message: '<details><summary><a href="${{ env.DEPLOY_DOMAIN }}">Превью контента</a> из ${{ github.event.after }} опубликовано.</summary>${{ steps.links.outputs.list }}</details>' | |
recreate: true |