mirror of
https://github.com/DS-Homebrew/flashcard-archive.git
synced 2024-10-22 11:45:06 +02:00
5fa351a3a0
https://github.com/timo-reymann/deterministic-zip This solves a logistics issue; zip files always include the modified timestamp of a file. This doesn't sound bad until you realize that GitHub Actions always re-clones the entire repository, and the timestamp is guaranteed to be different. Because of this, every time we run our Actions workflow, the zip will have a different checksum, causing git to re-commit *every single file* to the frontend repository, causing long workflow times due to the sheer size of each commit. deterministic-zip hopefully solves this issue by forcing the modified timestamp to one hardcoded in its binary, so here is to hoping we don't abuse our git repo any further.
54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
name: Deploy site
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install deterministic zip
|
|
run: |
|
|
wget https://github.com/timo-reymann/deterministic-zip/releases/latest/download/deterministic-zip_linux-amd64
|
|
chmod +x deterministic-zip_linux-amd64
|
|
sudo mv deterministic-zip_linux-amd64 /usr/local/bin/zip
|
|
|
|
- name: Package files
|
|
run: |
|
|
cd archive
|
|
chmod +x build.sh
|
|
./build.sh
|
|
|
|
# to get README.md to webpage as well as GitHub's UI
|
|
- name: Pre-generation of directory listing
|
|
run: cp README.md out/README.md
|
|
|
|
- name: Github Pages Directory Listing
|
|
uses: jayanta525/github-pages-directory-listing@v4
|
|
with:
|
|
FOLDER: out
|
|
|
|
# these shouldn't be in apindex, but need to be in repo root for GitHub Pages
|
|
- name: Pre-generation of directory listing
|
|
run: |
|
|
mkdir public
|
|
cp -r out/* public
|
|
cp CNAME public
|
|
touch public/.nojekyll
|
|
|
|
- name: Deploy 🚀
|
|
uses: JamesIves/github-pages-deploy-action@v4.4.3
|
|
with:
|
|
repository-name: DS-Homebrew/flashcard-archive-web
|
|
token: ${{ secrets.WEB_PUSH_TOKEN }}
|
|
branch: gh-pages # The branch the action should deploy to.
|
|
folder: public # The folder the action should deploy.
|
|
clean: true # Automatically remove deleted files from the deploy branchimage: ubuntu:bionic
|