Skip to content

Publish

Publish #17321

Workflow file for this run

name: "Publish"
on:
push:
branches: master
workflow_dispatch:
inputs:
tmate_enabled:
type: boolean
description: 'Run a tmate session'
required: false
default: true
schedule:
- cron: "0 */2 * * *" # every 2h
permissions:
contents: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: ${{ github.event_name }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-22.04 # change to -latest when possible
container:
image: ghcr.io/tecosaur/emacs-config:latest
options: --user 0 # root
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
steps:
- name: Clone Doom to ~/.config/emacs
run: runner 'git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.config/emacs'
- name: Get Doom's version
id: doom-version
run: runner 'cd ~/.config/emacs && echo "doom_hash=$(git log -1 | head -1 | awk '"'"'{print substr($2,1,8)}'"'"')"' >> $GITHUB_ENV
- name: Cache Doom's Install
id: doomcache
uses: actions/cache@v4
with:
path: /home/runner/.config/emacs
key: ${{ runner.os }}-doom@${{ env.doom_hash }}
- name: Checkout config
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
run: runner 'git clone --depth 1 --recurse-submodules https://github.com/tecosaur/emacs-config.git ~/.config/doom'
- name: Create bootstrap init.el
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
run: runner 'echo "(doom! :config literate)" > ~/.config/doom/init.el'
- name: Install Doom
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
run: runner '~/.config/emacs/bin/doom install --no-env --no-fonts'
- name: Run Doom sync
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
run: runner '~/.config/emacs/bin/doom -! sync'
- name: Pull latest (dev) org-mode
if: steps.doomcache.outputs.cache-hit == 'true'
run: runner 'rm -r ~/.config/emacs/.local/straight/build-*/org/ && pushd ~/.config/emacs/.local/straight/repos/org/ && git fetch tecosaur dev && git reset --hard tecosaur/dev && popd'
- name: Rebuild changed packages
run: runner '~/.config/emacs/bin/doom -! sync -B'
- name: Ensure emoji vector graphics exist
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
run: runner "emacs --batch --eval \"(progn (load \\\"~/.config/emacs/lisp/doom.el\\\") (require 'doom-cli) (doom-initialize-packages) (load \\\"~/.config/doom/subconf/ox-latex-emoji.el\\\") (unless (file-exists-p (expand-file-name \\\"twemoji\\\" org-latex-emoji-base-dir)) (org-latex-emoji-install \\\"twemoji\\\" t)))\""
- name: Export config
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
run: runner 'cd ~/.config/doom/misc/config-publishing && ./publish.sh'
- name: Push results
if: (github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true') && success()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: /home/runner/.config/doom/publish
publish_branch: publish
force_orphan: true
- name: Setup Pages
if: (github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true') && success()
uses: actions/configure-pages@v4
- name: Upload artifact
if: (github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true') && success()
uses: actions/upload-pages-artifact@v3
with:
path: '/home/runner/.config/doom/publish'
- name: Deploy to GitHub Pages
if: (github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true') && success()
id: deployment
uses: actions/deploy-pages@v4
- name: Debug over SSH (tmate)
if: ${{ github.event_name == 'workflow_dispatch' && inputs.tmate_enabled }}
uses: mxschmitt/action-tmate@v3