emacs-config/.github/workflows/publish.yml

61 lines
2.3 KiB
YAML

name: "Publish"
on:
pull_request:
push:
branches: master
schedule:
- cron: "0 */2 * * *" # every 2h
jobs:
deploy:
runs-on: ubuntu-20.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 ~/.emacs.d
run: runner 'git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d'
- name: Get Doom's version
id: doom-version
run: runner 'cd ~/.emacs.d && echo "::set-output name=hash::$(git log -1 | head -1 | awk '"'"'{print substr($2,1,7)}'"'"')"'
- name: Cache Doom's Install
id: doomcache
uses: actions/cache@v2
with:
path: /home/runner/.emacs.d
key: ${{ runner.os }}-doom@${{ steps.doom-version.outputs.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: 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 '(progn (setq org-confirm-babel-evaluate nil) (org-babel-tangle-file \"config.org\"))'"
- name: Setup Doom
if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true'
run: runner '~/.emacs.d/bin/doom install --no-env --no-fonts'
- 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: Deploy
if: github.event_name != 'pull_request' && ( github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true')
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: /home/runner/.config/doom/publish
force_orphan: true
# - name: Debug over SSH (tmate)
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3.1