name: "Publish" on: push: branches: master 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 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 ~/.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@v2 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: Rebuild changed packages if: github.event_name != 'schedule' || steps.doomcache.outputs.cache-hit != 'true' run: runner '~/.config/emacs/bin/doom build -r' - 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@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