From 5a429c0acbf8a10f52ee0d8dec4957f480c835d6 Mon Sep 17 00:00:00 2001 From: dongdigua Date: Sat, 10 Dec 2022 14:05:00 +0800 Subject: [PATCH] test CI --- .github/workflows/site.yml | 62 ++++++++++++++++++++++++++++++++++++++ org/Makefile | 4 +-- org/publish_config.el | 12 ++++++-- 3 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/site.yml diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml new file mode 100644 index 0000000..ec8a218 --- /dev/null +++ b/.github/workflows/site.yml @@ -0,0 +1,62 @@ +name: Deploy with Org and Jekyll + +on: + push: + branches: ["main"] + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Emacs + uses: purcell/setup-emacs@master + with: + version: 28.1 + + - name: Build with Org + run: | + cd org + make clean + make + tree ../ + + - name: Setup Pages + uses: actions/configure-pages@v2 + + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./ + destination: ./_site + + - name: Patch HTML + run: | + tree _site + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 + diff --git a/org/Makefile b/org/Makefile index 375189a..fd744d8 100644 --- a/org/Makefile +++ b/org/Makefile @@ -12,5 +12,5 @@ html: clean: - rm ~/.org-timestamps/org-pages.cache - $(TARGET) | xargs -I {} rm {} - rm ../feed.xml* + - $(TARGET) | xargs -I {} rm {} + - rm ../feed.xml* diff --git a/org/publish_config.el b/org/publish_config.el index c0074d3..9aa5c9b 100644 --- a/org/publish_config.el +++ b/org/publish_config.el @@ -4,10 +4,16 @@ ;; System Crafter's video: https://youtu.be/AfkrzFodoNw -(eval-when-compile - (require 'package) - (package-initialize) +(require 'package) +(package-initialize) +;; https://liujiacai.net/blog/2021/05/05/emacs-package +(when (not package-archive-contents) + (package-refresh-contents)) +(dolist (p '(webfeeder)) + (when (not (package-installed-p p)) + (package-install p))) +(eval-when-compile (require 'org) (require 'ox) (require 'webfeeder))