Skip to content

Improve reports

Improve reports #3

Workflow file for this run

# Makes screenshots of the project and publishes them as comment
name: Screenshots
on:
# Runs on pushes targeting the default branch
pull_request:
branches: ["main"]
# Default to bash
defaults:
run:
shell: bash
jobs:
# Check on PR
screenshots:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.108.0
permissions:
# Required to upload/save artifact, otherwise you'll get
# "Error: Resource not accessible by integration"
contents: write
# Required to post comment, otherwise you'll get
# "Error: Resource not accessible by integration"
pull-requests: write
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
working-directory: ./src
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--minify
- name: Make screenshots
run: npm run screenshot
- name: Upload files as artifacts
id: upload-files-artifacts
uses: actions/upload-artifact@master
with:
name: Screenshots
path: |
src/public/index.html
./*.jpg
- name: Upload files to Imgbb
id: upload-files-imgbb
uses: McCzarny/upload-image@v1.0.0
with:
path: |
./320x568.jpg
./568x320.jpg
./360x780.jpg
./780x360.jpg
./375x812.jpg
./812x375.jpg
./390x844.jpg
./844x390.jpg
./430x932.jpg
./932x430.jpg
./768x1024.jpg
./1024x768.jpg
./820x1180.jpg
./1180x820.jpg
./1280x720.jpg
./1920x1080.jpg
uploadMethod: imgbb
apiKey: '${{ secrets.IMGBB_API_KEY }}'
- name: Publish the images
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# Screenshots
## Smartphones
### iPhone 5
| Portrait Mode | Landscape Mode |
|----|----|
| ![iPhone 5 portrait mode screenshot]({{steps.upload-files-imgbb.outputs.url[0]}}) | ![iPhone 5 portrait mode screenshot]({{steps.upload-files-imgbb.outputs.url[1]}}) |
### Tablets
### Desktop
[Full ZIP](${{ steps.upload-files-artifacts.outputs.artifact-url }})