Improve publish #38
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: Publish to git to static pages | |
permissions: | |
contents: none | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish-pages: | |
environment: | |
name: main | |
url: https://williamdes.eu | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
token: ${{ secrets.SUDO_BOT_TOKEN }} | |
# Already the default value, but so you understand the push command will have creds | |
persist-credentials: true | |
- name: Import GPG key | |
# v6.1.0 - 01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 | |
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Build and push | |
run: | | |
set -o xtrace | |
make build | |
TEMP_DIR="$(mktemp -d --suffix=_website_williamdes)" | |
cp -rp williamdes.eu/public "${TEMP_DIR}" | |
git checkout static-pages | |
git ls-files | xargs -r -n 1 rm -vf | |
rm -rfd ./* | |
mv "${TEMP_DIR}"/public/* ./ | |
rm -rf "${TEMP_DIR}" | |
git add -A | |
git commit --allow-empty -m "Content update ($(date --utc))" | |
git push |