Skip to content

Commit

Permalink
ci: try to re-generate previews
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoudham committed Aug 9, 2024
1 parent c3a3286 commit 2237f03
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/previews.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Generate Previews

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'icons/**'
- scripts/icons/preview.ts
- scripts/catwalk.ts
tags-ignore: [v*]

jobs:
generate-previews:
name: Generate Previews
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install dependencies
run: pnpm i --frozen-lockfile

- name: Generate Flavor Previews
run: pnpm icons:preview

- name: Install catppuccin/catwalk
shell: bash
run: |
mkdir /tmp/catwalk
cd /tmp/catwalk
curl -LSs https://github.com/catppuccin/catwalk/releases/download/v1.3.2/catwalk-aarch64-apple-darwin -o catwalk
chmod +x catwalk
echo `pwd` >> $GITHUB_PATH
- name: Generate Catwalk Preview
run: pnpm catwalk

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'chore: re-generate previews'
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: chore/re-generate-previews
delete-branch: true
title: 'chore: re-generate previews'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
.pnpm-debug.log*
*.vsix
.DS_Store
.cache
4 changes: 3 additions & 1 deletion scripts/catwalk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ try {
const htmlPath = join(tmp, `${flavor}.html`)
const screenshotPath = join(tmp, `${flavor}.png`)
await writeFile(htmlPath, generateHtml(flavor))
const browser = await launch()
const browser = await launch({
args: ['--no-sandbox'],
})
const page = await browser.newPage()
await page.setViewport({
height: 400,
Expand Down
4 changes: 3 additions & 1 deletion scripts/icons/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ try {
const htmlPath = join(tmp, `${flavor}.html`)
const screenshotPath = join('assets', `${flavor}.webp`)
await writeFile(htmlPath, generateHtml(flavor))
const browser = await launch()
const browser = await launch({
args: ['--no-sandbox'],
})
const page = await browser.newPage()
await page.goto(join('file:', htmlPath))
await page.screenshot({
Expand Down

0 comments on commit 2237f03

Please sign in to comment.