Add preview deployments (#108)

This commit is contained in:
Piotr Rogowski 2023-06-28 20:20:34 +02:00 committed by GitHub
parent 654f9ef4f2
commit 8659d6527c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 22 deletions

View File

@ -1,22 +0,0 @@
name: Build
concurrency:
group: ${{ github.ref }}-build-js
cancel-in-progress: true
on:
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build

62
.github/workflows/preview.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: Preview
concurrency:
group: ${{ github.ref }}-preview
cancel-in-progress: true
on:
pull_request:
branches: [ master ]
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install PrinceXML
run: |
curl https://www.princexml.com/download/prince-15.1-linux-generic-x86_64.tar.gz -O
tar zxf prince-15.1-linux-generic-x86_64.tar.gz
cd prince-15.1-linux-generic-x86_64
yes "" | sudo ./install.sh
- name: Install Node.js dependencies
run: npm ci
- name: Build
run: npm run build
- name: Generate PDF
run: |
npm run serve &
sleep 5
npm run pdf
- name: Check for generated PDF
run: ls -lah static/pdf/wiki.fome.pdf
- name: Rebuild with PDF
run: npm run build
- name: Check for bundled PDF
run: ls -lah build/pdf/wiki.fome.pdf
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: wiki
directory: build
gitHubToken: ${{ secrets.GITHUB_TOKEN }} # GitHub Deployments
wranglerVersion: '3'