2020-11-03 09:53:56 +00:00
|
|
|
name: "Publish"
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches: master
|
2021-01-23 09:47:27 +00:00
|
|
|
schedule:
|
2021-02-13 03:19:57 +00:00
|
|
|
- cron: "0 */2 * * *" # every 2h
|
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:
|
2021-01-23 09:31:41 +00:00
|
|
|
- name: Clone Doom to ~/.emacs.d
|
2021-02-12 05:40:08 +00:00
|
|
|
run: runner 'git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d'
|
2020-11-03 09:53:56 +00:00
|
|
|
|
2021-01-23 09:31:41 +00:00
|
|
|
- name: Get Doom's version
|
|
|
|
id: doom-version
|
2021-02-12 05:40:08 +00:00
|
|
|
run: runner 'cd ~/.emacs.d && echo "::set-output name=hash::$(git log -1 | head -1 | awk '"'"'{print substr($2,1,7)}'"'"')"'
|
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:
|
2021-02-12 05:40:08 +00:00
|
|
|
path: /home/runner/.emacs.d
|
2021-01-23 09:31:41 +00:00
|
|
|
key: ${{ runner.os }}-doom@${{ steps.doom-version.outputs.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'
|
|
|
|
|
|
|
|
- name: Generate init.el et. al from config.org
|
|
|
|
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
|
|
|
|
run: runner "cd ~/.config/doom && emacs --batch --eval \"(require 'org)\" --eval '(org-babel-tangle-file \"config.org\")'"
|
|
|
|
|
|
|
|
- name: Setup Doom
|
|
|
|
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
|
2021-02-12 05:40:08 +00:00
|
|
|
run: runner '~/.emacs.d/bin/doom install --no-env --no-fonts'
|
2021-01-28 08:39:19 +00:00
|
|
|
|
2021-01-23 09:31:41 +00:00
|
|
|
- name: Export config
|
2021-02-13 03:19:57 +00:00
|
|
|
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
|
2021-02-12 05:40:08 +00:00
|
|
|
run: runner 'cd ~/.config/doom/misc/config-publishing && ./publish.sh'
|
2021-01-25 02:19:59 +00:00
|
|
|
|
2021-01-23 09:31:41 +00:00
|
|
|
- name: Deploy
|
2021-02-13 03:19:57 +00:00
|
|
|
if: github.event_name != 'pull_request' && ( github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true')
|
2021-01-23 09:31:41 +00:00
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
with:
|
|
|
|
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
2021-02-12 05:40:08 +00:00
|
|
|
publish_dir: /home/runner/.config/doom/publish
|
2021-01-23 09:31:41 +00:00
|
|
|
force_orphan: true
|
2021-02-12 05:40:08 +00:00
|
|
|
|
2021-02-13 03:19:57 +00:00
|
|
|
# - name: Debug over SSH (tmate)
|
|
|
|
# if: ${{ failure() }}
|
|
|
|
# uses: mxschmitt/action-tmate@v3.1
|