SEO #355
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
# This workflow will do a clean install of node dependencies, build the source code and run tests | |
name: 'SEO' | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
deploy-production: | |
name: 'Generate SEO files' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- environment: production-01 | |
host: SSH_HOST_PRODUCTION_01 | |
- environment: production-02 | |
host: SSH_HOST_PRODUCTION_02 | |
- environment: production-03 | |
host: SSH_HOST_PRODUCTION_03 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_PRIVATE_KEY" > ./deploy.key | |
sudo chmod 600 ./deploy.key | |
ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts | |
shell: bash | |
env: | |
SSH_PRIVATE_KEY: ${{secrets.SSH_MACHINE_USER_PRIVATE_KEY}} | |
SSH_HOST: ${{ secrets[matrix.host] }} | |
- name: Deploy to production | |
run: ssh -v -i ./deploy.key www-data@$SSH_HOST '/opt/docker/app/sitemap/deploy.sh >> /var/log/cron_build_sitemap' | |
env: | |
SSH_HOST: ${{ secrets[matrix.host] }} | |
- name: Notify failure only | |
if: failure() | |
uses: ./.github/actions/notify | |
with: | |
message: '🚨 ${{ github.event.repository.name }} : deploy SEO files to production failed' | |
hook: ${{ secrets.TCHAP_HOOK }} | |
id: ${{ secrets.TCHAP_ROOM_ID }} | |
notify-deploy-success: | |
name: Notify successful deployment | |
runs-on: ubuntu-latest | |
needs: [deploy-production] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Notify deploy succes | |
uses: ./.github/actions/notify | |
with: | |
message: '✅ ${{ github.event.repository.name }} : successfully deploy SEO files to production' | |
hook: ${{ secrets.TCHAP_HOOK }} | |
id: ${{ secrets.TCHAP_ROOM_ID }} |