xkcd/.github/workflows/cron.yml
2023-11-27 16:13:40 +00:00

108 lines
3.8 KiB
YAML

name: update XKCD archive
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
schedule:
- cron: "0 0 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
updatexkcd:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Go install
run: go install .
- name: Make output dir
run: mkdir result/
- name: Go run
run: go run . result/www -f 1 -t 5
- name: create .ipfsignore
run: touch result/www/.ipfsignore
- name: create .nojekyll
run: touch result/www/.nojekyll
- name: create ipfs-add.sh
run: cp _ipfs-add.sh result/www/ipfs-add.sh; (cd result/www; find -type f > ../../.github/files-to-cache.lst)
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'result/www'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# - name: Download IPFS
# run: ./.github/github_install_ipfs.sh
# - name: Print IPFS hash
# run: PATH="/tmp/kubo:$PATH" ipfs cid base32 "$(ipfs add --ignore-rules-path "result/www/.ipfsignore" --pin=false --hidden -Qr "result/www/")"
#
# - name: Make tarball of website
# run: mkdir -p "$RUNNER_TEMP" && tar --directory result/www/ -cvf "$RUNNER_TEMP/artifact.tar" .
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: github-pages
# path: ${{ runner.temp }}/artifact.tar
# if-no-files-found: error
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v2
#
## - name: Setup Pages
## uses: actions/configure-pages@v3
## - name: Upload artifact
## uses: actions/upload-pages-artifact@v2
## with:
## # Upload entire folder
## path: 'result/www/'
## - name: Deploy to GitHub Pages
## id: deployment
## uses: actions/deploy-pages@v2
#
# - name: Upload to IPFS
# run: PATH="/tmp/kubo:$PATH" ./.github/pin-using-ipfs.sh
# continue-on-error: true
# env:
# IPFS_SWARM_CONNECT_TO: ${{ secrets.IPFS_SWARM_CONNECT_TO }}
# IPFS_REMOTE_API_ENDPOINT: ${{ secrets.IPFS_REMOTE_API_ENDPOINT }}
# IPFS_REMOTE_TOKEN: ${{ secrets.IPFS_REMOTE_TOKEN }}
# - name: Install OVH pip package
# run: pip install ovh
# - name: Update OVH _dnslink
# run: export PATH="/tmp/kubo:$PATH"; export IPFS_HASH="$(ipfs cid base32 "$(ipfs add --ignore-rules-path "result/www/.ipfsignore" --pin=false --hidden -Qr "result/www/")")"; python ./.github/update-ovh.py >/dev/null 2>&1
# env:
# API_OVH_APPLICATION_KEY: ${{ secrets.API_OVH_APPLICATION_KEY }}
# API_OVH_APPLICATION_SECRET: ${{ secrets.API_OVH_APPLICATION_SECRET }}
# API_OVH_CONSUMER_KEY: ${{ secrets.API_OVH_CONSUMER_KEY }}
# API_OVH_ENDPOINT: ${{ secrets.API_OVH_ENDPOINT }}
# OVH_DNS_DOMAIN: ${{ secrets.OVH_DNS_DOMAIN }}
# OVH_DNS_RECORD_ID: ${{ secrets.OVH_DNS_RECORD_ID }}
# - name: Warm up IPFS gateway caches
# run: PATH="/tmp/kubo:$PATH" ./.github/warm-up-gateway-caches.sh
# - name: Update homepage URL
# run: PATH="/tmp/kubo:$PATH" ./.github/github_update_homepage.sh
# env:
# API_TOKEN_FOR_UPDATE_HOMEPAGE: ${{ secrets.API_TOKEN_FOR_UPDATE_HOMEPAGE }}