mirror of
https://github.com/Smart123s/ItchClaim.git
synced 2025-07-29 21:37:20 +02:00
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
name: Deploy Web
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '18 0,6,12,18 * * *'
|
|
push:
|
|
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 --dir web/data/
|
|
- name: Generate index.html
|
|
run: python itchclaim.py generate_web --dir web/data/ --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
|
|
|
|
# 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 |