aperta-principium/Interclip

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
name: Deploy Interclip
on:
  push:
    branches:
      - main
  release:
    types: [published]

jobs:
  deploy-production:
    name: Deploy to production
    runs-on: ubuntu-latest
    steps:
      - name: Git pull on the server
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          port: ${{ secrets.PORT }}
          script: cd /var/www/html && sudo git pull --all && sudo composer install && yarn && yarn build
  deploy-staging:
    name: Deploy to staging
    runs-on: ubuntu-latest
    if: false
    steps:
      - name: Git pull on the server
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          port: ${{ secrets.PORT }}
          script: cd /var/www/staging && sudo git pull --all && sudo composer install && yarn && yarn build
  purge-cache:
    name: Purge Cloudflare cache
    needs: [deploy-production]
    if: always()
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Setup Deno
        uses: denolib/setup-deno@v2
        with:
          deno-version: v1.x
      - name: Purge Cloudflare cache
        run: deno run --allow-net --allow-env --allow-run scripts/cachePurge.ts
        env:
          CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE }}
          CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }}

  audit:
    name: Audit the production site with Lighthouse
    needs: purge-cache
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Audit URLs using Lighthouse
        uses: treosh/lighthouse-ci-action@10.1.0
        with:
          urls: |
            https://interclip.app/
            https://interclip.app/file
            https://interclip.app/receive
            https://interclip.app/privacy
            https://interclip.app/about
            https://interclip.app/desktop
          runs: 3
          budgetPath: ./budget.json # test performance budgets
          uploadArtifacts: true # save results as an action artifacts
          temporaryPublicStorage: true # upload lighthouse report to the temporary storage