mirror of
https://github.com/Smart123s/ItchClaim.git
synced 2025-07-27 15:37:34 +02:00
82 lines
2.3 KiB
YAML
82 lines
2.3 KiB
YAML
name: Web
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
sales:
|
|
type: string
|
|
description: |
|
|
Comma separated values of the games to explicitly refresh.
|
|
Resumes refresh from previous end point if left empty.
|
|
Example (without apostrophes): '2, 5, 88888'
|
|
required: false
|
|
schedule:
|
|
- cron: '18 0,6,12,18 * * *'
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
# Build job
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
cache: 'pip'
|
|
- name: Install Dependencies
|
|
run: pip install -r requirements.txt
|
|
shell: bash
|
|
- name: Get current date
|
|
id: date
|
|
run: echo "date=$(date +'%Y-%m-%d--%H-%M-%S')" >> $GITHUB_OUTPUT
|
|
- name: Persist previously collected sales
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: sale-data-v1.1
|
|
with:
|
|
path: web/data/
|
|
key: ${{ env.cache-name }}-${{ steps.date.outputs.date }}
|
|
restore-keys: |
|
|
${{ env.cache-name }}
|
|
- name: Refresh sales from itch.io
|
|
run: python itchclaim.py refresh_sale_cache --games_dir web/data/ --sales "[${{ github.event.inputs.sales }}]"
|
|
- name: Generate index.html and JSON data
|
|
run: python itchclaim.py generate_web --web_dir web/
|
|
- name: Upload Page
|
|
uses: actions/upload-pages-artifact@v1
|
|
with:
|
|
path: web/
|
|
|
|
# Deploy job
|
|
deploy:
|
|
# Add a dependency to the build job
|
|
needs: build
|
|
|
|
# Don't deploy pull requests
|
|
if: github.event_name != 'pull_request'
|
|
|
|
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
|
|
permissions:
|
|
pages: write # to deploy to Pages
|
|
id-token: write # to verify the deployment originates from an appropriate source
|
|
|
|
# Deploy to the github-pages environment
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
|
|
# Specify runner + deployment step
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v1
|