Skip to content

Build

Build #1360

Workflow file for this run

name: Build
on:
push:
branches:
- master
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- name: Build production assets
run: yarn && yarn build
- name: Copy production assets
run: rm -rfv gh-pages/* && cp -val site/* gh-pages
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
- name: Validate composer.json
run: composer validate
- name: Cache dependencies
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
- name: Install dependencies
run: composer install --no-interaction --no-progress
- name: Acquire snapshots
run: |
snapshots=$(vendor/bin/250\ data download-last2) && echo "$snapshots"
echo todayDb=$(sed 1!d <<<"$snapshots" | cut -f3) | tee -a "$GITHUB_ENV"
echo todayDir=$(sed 1!d <<<"$snapshots" | cut -f2) | tee -a "$GITHUB_ENV"
echo yesterdayDb=$(sed 2!d <<<"$snapshots" | cut -f3) | tee -a "$GITHUB_ENV"
env:
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }}
- name: Build site
run: bin/generate site -v --min --ext '' --prev-db "${{ env.yesterdayDb }}" "${{ env.todayDb }}" gh-pages
| tee out
shell: bash # enable pipefail LOL
- name: Push site
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add -A . &&
git commit -m "Built from $GITHUB_SHA." &&
[[ -r CNAME && -r index.html ]] && git push
working-directory: gh-pages
- name: Upload modified database
run: |
mv "${{ env.todayDb }}" steam.sqlite
vendor/bin/250\ data upload $_ "${{ env.todayDir }}"
vendor/bin/250\ data move "${{ env.todayDir }}"
env:
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }}
- name: Trigger curator sync
run: curl -sS -u :"${{ secrets.GH_BILGE_TOKEN }}" -d '{"ref":"master"}'
$GITHUB_API_URL/repos/250/Steam-curator/actions/workflows/Curator%20sync.yml/dispatches
- name: Ensure no errors in build output
run: '! grep --extended-regexp --context 1 ''^\[[^]]+\] [A-Z]\w{3}:'' out'