2020-11-03 09:53:56 +00:00
|
|
|
name: "Publish"
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: master
|
2023-01-24 09:55:25 +00:00
|
|
|
delete:
|
|
|
|
ref: "refs/heads/publish"
|
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
|
|
|
- cron: "0 */2 * * *" # every 2h
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
# Allow one concurrent deployment
|
|
|
|
concurrency:
|
|
|
|
group: "pages"
|
|
|
|
cancel-in-progress: true
|
2020-11-03 09:53:56 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-20.04 # change to -latest when possible
|
2021-02-12 05:40:08 +00:00
|
|
|
container:
|
|
|
|
image: ghcr.io/tecosaur/emacs-config:latest
|
|
|
|
options: --user 0 # root
|
|
|
|
credentials:
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GHCR_TOKEN }}
|
2020-11-03 09:53:56 +00:00
|
|
|
|
|
|
|
steps:
|
2022-12-08 16:11:12 +00:00
|
|
|
- name: Clone Doom to ~/.config/emacs
|
|
|
|
run: runner 'git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.config/emacs'
|
2020-11-03 09:53:56 +00:00
|
|
|
|
2021-01-23 09:31:41 +00:00
|
|
|
- name: Get Doom's version
|
|
|
|
id: doom-version
|
2022-12-09 12:02:49 +00:00
|
|
|
run: runner 'cd ~/.config/emacs && echo "doom_hash=$(git log -1 | head -1 | awk '"'"'{print substr($2,1,8)}'"'"')"' >> $GITHUB_ENV
|
2020-11-03 09:53:56 +00:00
|
|
|
|
2021-02-13 03:19:57 +00:00
|
|
|
- name: Cache Doom's Install
|
|
|
|
id: doomcache
|
2021-01-23 09:31:41 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2022-12-08 16:11:12 +00:00
|
|
|
path: /home/runner/.config/emacs
|
2022-12-09 12:02:49 +00:00
|
|
|
key: ${{ runner.os }}-doom@${{ env.doom_hash }}
|
2020-11-03 09:53:56 +00:00
|
|
|
|
2021-02-13 03:19:57 +00:00
|
|
|
- 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'
|
|
|
|
|
2022-12-08 16:07:30 +00:00
|
|
|
- name: Create bootstrap init.el
|
2021-02-13 03:19:57 +00:00
|
|
|
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
|
2022-12-08 16:11:12 +00:00
|
|
|
run: runner 'echo "(doom! :config literate)" > ~/.config/doom/init.el'
|
2021-02-13 03:19:57 +00:00
|
|
|
|
2022-12-08 16:11:12 +00:00
|
|
|
- name: Install Doom
|
2021-02-13 03:19:57 +00:00
|
|
|
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
|
2022-12-08 16:11:12 +00:00
|
|
|
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'
|
2021-01-28 08:39:19 +00:00
|
|
|
|
2023-02-12 04:43:37 +00:00
|
|
|
- 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'
|
|
|
|
|
2022-12-09 12:02:49 +00:00
|
|
|
- name: Rebuild changed packages
|
|
|
|
run: runner '~/.config/emacs/bin/doom build -r'
|
|
|
|
|
2022-12-08 17:17:29 +00:00
|
|
|
- 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)))\""
|
|
|
|
|
2022-12-09 12:02:49 +00:00
|
|
|
- name: Export config
|
|
|
|
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
|
|
|
|
run: runner 'cd ~/.config/doom/misc/config-publishing && ./publish.sh'
|
2021-01-25 02:19:59 +00:00
|
|
|
|
2023-01-24 09:55:25 +00:00
|
|
|
- name: Push results
|
|
|
|
if: (github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true') && success()
|
2021-01-23 09:31:41 +00:00
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
with:
|
2022-12-09 12:02:49 +00:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2021-02-12 05:40:08 +00:00
|
|
|
publish_dir: /home/runner/.config/doom/publish
|
2023-01-24 09:55:25 +00:00
|
|
|
publish_branch: publish
|
2021-01-23 09:31:41 +00:00
|
|
|
force_orphan: true
|
2021-02-12 05:40:08 +00:00
|
|
|
|
2023-01-24 09:55:25 +00:00
|
|
|
- name: Setup Pages
|
|
|
|
if: (github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true') && success()
|
|
|
|
uses: actions/configure-pages@v2
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
if: (github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true') && success()
|
|
|
|
uses: actions/upload-pages-artifact@v1
|
|
|
|
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@v1
|
|
|
|
|
|
|
|
# - name: Debug over SSH (tmate)
|
|
|
|
# if: ${{ failure() }}
|
|
|
|
# uses: mxschmitt/action-tmate@v3.1
|