Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 3s
Monorepo Pipeline / 🧹 Lint (push) Failing after 1m24s
Monorepo Pipeline / 🧪 Test (push) Successful in 41s
Monorepo Pipeline / 🏗️ Build (push) Successful in 2m4s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
🏥 Server Maintenance / 🧹 Prune & Clean (push) Failing after 7s
70 lines
2.1 KiB
YAML
70 lines
2.1 KiB
YAML
name: Analytics Mailer
|
|
|
|
on:
|
|
schedule:
|
|
# Run weekly on Monday at 08:00 UTC
|
|
- cron: '0 8 * * 1'
|
|
# Run monthly on the 1st day of the month at 08:30 UTC
|
|
- cron: '30 8 1 * *'
|
|
workflow_dispatch:
|
|
inputs:
|
|
interval:
|
|
description: 'Interval to run (weekly or monthly)'
|
|
required: true
|
|
default: 'weekly'
|
|
type: choice
|
|
options:
|
|
- weekly
|
|
- monthly
|
|
|
|
jobs:
|
|
send-reports:
|
|
name: 📊 Send Analytics Reports
|
|
runs-on: docker
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
UMAMI_BASE_URL: ${{ secrets.UMAMI_BASE_URL }}
|
|
UMAMI_USERNAME: ${{ secrets.UMAMI_USERNAME }}
|
|
UMAMI_PASSWORD: ${{ secrets.UMAMI_PASSWORD }}
|
|
MAILGUN_API_KEY: ${{ secrets.MAILGUN_API_KEY }}
|
|
MAILGUN_DOMAIN: ${{ secrets.MAILGUN_DOMAIN }}
|
|
MAILGUN_SENDER: ${{ secrets.MAILGUN_SENDER }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node_version: 20
|
|
|
|
- name: Enable pnpm
|
|
run: corepack enable && corepack prepare pnpm@10.2.0 --activate
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts --no-color
|
|
|
|
- name: Build mail templates
|
|
run: pnpm --filter @mintel/mail build
|
|
|
|
- name: Build analytics mailer
|
|
run: pnpm --filter @mintel/analytics-mailer build
|
|
|
|
- name: Determine Interval
|
|
id: set-interval
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "schedule" ]; then
|
|
if [ "${{ github.event.schedule }}" = "0 8 * * 1" ]; then
|
|
echo "interval=weekly" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "interval=monthly" >> $GITHUB_OUTPUT
|
|
fi
|
|
else
|
|
echo "interval=${{ github.event.inputs.interval }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Run Analytics Mailer
|
|
run: pnpm --filter @mintel/analytics-mailer run start -- --interval=${{ steps.set-interval.outputs.interval }}
|