Product Deploy #2586
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: Product Deploy | |
on: | |
workflow_run: | |
workflows: | |
- "Update Dates" | |
branches: | |
- main | |
types: | |
- completed | |
jobs: | |
product-deploy: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PATH_TO_CONTENT: ./content | |
steps: | |
- name: Загрузка platform | |
uses: actions/checkout@v2 | |
with: | |
repository: doka-guide/platform | |
- name: Загрузка контента | |
uses: actions/checkout@v2 | |
with: | |
path: content | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Кэширование модулей | |
uses: actions/cache@v2 | |
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: Установка ключа для пользователя | |
run: | | |
set -eu | |
mkdir "$HOME/.ssh" | |
echo "${{ secrets.DEPLOY_KEY }}" > "$HOME/.ssh/doka_deploy" | |
chmod 600 "$HOME/.ssh/doka_deploy" | |
echo "${{ secrets.DEPLOY_CONFIG }}" > "$HOME/.ssh/config" | |
chmod 600 "$HOME/.ssh/config" | |
ssh -o StrictHostKeyChecking=no [email protected] | |
- name: Установка модулей | |
run: npm ci | |
- name: Сборка сайта | |
run: | | |
cp .env.example .env | |
npm run build | |
- name: Генерация карточек для социальных сетей | |
run: npx gulp socialCards | |
- name: Публикация сайта | |
run: | | |
cd dist | |
rsync --exclude 'api.json' --exclude 'mail' --archive --progress --compress --delete . dev.doka.guide:/web/sites/doka.guide/www/ |