Repository navigation
123 lines (107 loc) · 4.07 KB
/
Copy pathog.yml
File metadata and controls
123 lines (107 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: og cards
# Manual only, and deliberately so.
#
# Regenerating cards writes to public/og, which is tracked, so this job opens a
# pull request as the web bot (docs/deployment.md, "The web bot"). Its key
# must never reach code from a fork, which rules out `pull_request`. A
# maintainer runs this after merging a content change instead.
on:
workflow_dispatch:
inputs:
type:
description: "Which set to regenerate"
required: true
default: "all"
type: choice
options: [all, site, blog, database, compare, feature]
locale:
description: "Which language's cards"
required: true
default: "all"
type: choice
options: [all, en, vi, es, de, fr, ja, pt-BR, zh-Hans, ko, zh-Hant, it, id]
slug:
description: "Single slug (optional)"
required: false
type: string
permissions:
contents: read
jobs:
generate:
runs-on: ubuntu-26.04
environment: web-bot
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.5"
tools: composer:v2
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version-file: .node-version
# This job holds a write token, so keep setup-node's automatic npm
# cache off, as its README advises for such workflows.
package-manager-cache: false
- name: Resolve the Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache Composer downloads
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ hashFiles('composer.lock') }}
restore-keys: composer-${{ runner.os }}-
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
# The card templates embed the site's own fonts (resources/css/fonts.css)
# from node_modules, so a card rendered here has the same Inter glyphs
# as one rendered on a Mac, Vietnamese included.
- name: Install Node dependencies
run: npm ci --ignore-scripts
- name: Install Chromium
run: |
npm install -g puppeteer
npx puppeteer browsers install chrome
- name: Install CJK fonts
run: sudo apt-get update && sudo apt-get install -y fonts-noto-cjk
- name: Prepare environment
run: |
cp .env.example .env
php artisan key:generate
# WEB_DOMAIN overrides the localhost value .env.example carries: each
# card prints its page's canonical address.
- name: Generate cards
env:
WEB_DOMAIN: tablepro.app
OG_TYPE: ${{ inputs.type }}
OG_LOCALE: ${{ inputs.locale }}
OG_SLUG: ${{ inputs.slug }}
run: |
ARGS=(--type="$OG_TYPE" --locale="$OG_LOCALE")
if [ -n "$OG_SLUG" ]; then ARGS+=(--slug="$OG_SLUG"); fi
php artisan og:generate "${ARGS[@]}"
- name: Mint a web bot token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.WEB_BOT_CLIENT_ID }}
private-key: ${{ secrets.WEB_BOT_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- name: Open a pull request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ steps.app-token.outputs.token }}
sign-commits: true
branch: bot/og-cards
delete-branch: true
commit-message: "chore(og): regenerate social cards"
title: "chore(og): regenerate social cards"
# public/og.png is the English generic card, written in place by --type=site.
add-paths: |
public/og/**
public/og.png