Use only percentages #210
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-html | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Nene | |
run: python -m pip install -r requirements.txt | |
- name: Build the website | |
run: nene | |
- name: Clone the leouieda.github.io repository | |
uses: actions/checkout@v4 | |
with: | |
repository: leouieda/leouieda.github.io | |
ref: 'main' | |
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
# Checkout to this folder instead of the current one | |
path: deploy | |
# Download the entire history | |
fetch-depth: 0 | |
- name: Push to leouieda.github.io | |
if: success() && github.event_name == 'push' | |
run: | | |
# Make the new commit message. Needs to happen before cd into deploy | |
# to get the right commit hash. | |
message="Deploy from ${GITHUB_REPOSITORY}@$(git rev-parse --short HEAD)" | |
cd deploy | |
# Delete all the files and replace with our new set | |
echo -e "\nRemoving old files from previous builds:" | |
rm -rvf * | |
echo -e "\nCopying HTML files:" | |
cp -Rvf ../_build/* . | |
# Stage the commit | |
git add -A . | |
echo -e "\nChanges to be applied:" | |
git status | |
# Configure git to be the GitHub Actions account | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
# Amend the previous commit to avoid having a long history | |
echo -e "\nAmending last commit:" | |
git commit --amend --reset-author -m "$message" | |
# Make the push quiet just in case there is anything that could leak | |
# sensitive information. | |
echo -e "\nPushing changes:" | |
git push -fq origin main 2>&1 >/dev/null | |
echo -e "\nFinished uploading generated files." |