diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml
new file mode 100644
index 00000000..3e89a98e
--- /dev/null
+++ b/.github/workflows/build-and-deploy.yml
@@ -0,0 +1,86 @@
+name: Build and deploy vim help
+
+# This is an experimental.
+#
+# gh-pagesブランチを経由せず、actions/upload-pages-artifactを使って直接GitHub Pagesにデプロイする試み
+# pushのたびにいったん artifacts まで作る(HTML生成+Jekyll実行)
+# masterへのpushかcronでの実行であればGitHub Pagesへアップロードする
+# …という計画
+
+on:
+ push:
+
+ schedule:
+ - cron: '5 12 * * *'
+
+jobs:
+ build:
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Setup Vim
+ uses: thinca/action-setup-vim@v2
+ with:
+ vim_version: 'v9.1.0065'
+ vim_type: 'Vim'
+
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ #
+ # Generate HTML from Vim documents and upload it as an artifact.
+ #
+
+ - name: Generate new HTML documents
+ run: |
+ make html
+
+ - name: Check commit IDs
+ id: commitid
+ run: |
+ echo "vim=$(git -C vim rev-parse HEAD)" >> $GITHUB_OUTPUT
+ echo "vim_faq=$(git -C vim_faq rev-parse HEAD)" >> $GITHUB_OUTPUT
+
+ - name: Upload vim generated HTML files as an artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: vim-generated-html
+ path: target/html/doc/*.html
+
+ #
+ # Generate GitHub Page site and upload it as an artifact.
+ #
+
+ - name: Prepare for building GitHub Page (Jekyll)
+ run:
+ make jekyll-build-prepare
+
+ - name: Build GitHub Page site
+ uses: actions/jekyll-build-pages@v1
+ with:
+ source: target/jekyll-work
+ verbose: true
+
+ - name: Upload a site as an artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: _site/
+ retention-days: 7
+
+ # Upload a site to GitHub Pages
+ deploy:
+ needs:
+ - build
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-22.04
+ permissions:
+ contents: read
+ pages: write
+ id-token: write
+ # Run only when updating the master branch or when started by cron.
+ if: github.ref == 'refs/heads/master' || github.event_name == 'schedule'
+ steps:
+ - name: Deploy to Github Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml
index 02ec45a2..b0321a02 100644
--- a/.github/workflows/generate.yml
+++ b/.github/workflows/generate.yml
@@ -44,7 +44,7 @@ jobs:
run: |
echo "vim=$(git -C work/vim rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "vim_faq=$(git -C work/vim_faq rev-parse HEAD)" >> $GITHUB_OUTPUT
- - name: Commit updated master branch
+ - name: Commit updated gh-pages branch
uses: EndBug/add-and-commit@v9
with:
cwd: './target'
diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml
index 6372947a..b67c7908 100644
--- a/.github/workflows/trigger.yml
+++ b/.github/workflows/trigger.yml
@@ -17,3 +17,7 @@ jobs:
-H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
-H "Accept: application/vnd.github.v3+json" \
'https://api.github.com/repos/vim-jp/vimdoc-en/actions/workflows/trigger.yml/enable'
+ curl -i -X PUT \
+ -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
+ -H "Accept: application/vnd.github.v3+json" \
+ 'https://api.github.com/repos/vim-jp/vimdoc-en/actions/workflows/build-and-deploy.yml/enable'
diff --git a/.gitignore b/.gitignore
index 670d5b37..74103605 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
/target/
/vim/
/vim_faq/
+/tmp/
diff --git a/Makefile b/Makefile
index 7bead814..898f1d36 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,48 @@
.PHONY: all html clean
+JEKYLL_WORKDIR=target/jekyll-work
+JEKYLL_OUTDIR=target/_site
+
all:
+ $(MAKE) html
+ $(MAKE) jekyl-build-by-docker
+
+html-prepare: vim/runtime/doc vim_faq/doc target/html/doc
+ rm -f target/html/doc/*.txt
+ cp vim/runtime/doc/*.txt target/html/doc
+ cp vim_faq/doc/*.txt target/html/doc
-html:
- rm -rf target/html
- mkdir -p target/html/doc
- if [ ! -d vim/runtime/doc ]; then git clone --depth=1 https://github.com/vim/vim.git; fi
- if [ ! -d vim_faq/doc ]; then git clone --depth=1 https://github.com/chrisbra/vim_faq.git; fi
- cd vim; git apply ../tools/add-vimfaq-link.diff; cd ..
- cp vim/runtime/doc/*.txt vim_faq/doc/*.txt target/html/doc
+html: html-prepare
-cd target/html/doc ; vim -eu ../../../tools/buildhtml.vim -c "qall!"
+vim/runtime/doc:
+ git clone --depth=1 https://github.com/vim/vim.git
+ cd vim && git apply ../tools/add-vimfaq-link.diff
+
+vim_faq/doc:
+ git clone --depth=1 https://github.com/chrisbra/vim_faq.git
+
+target/html/doc:
+ mkdir -p $@
+
clean:
rm -rf target
+
+distclean: clean
+ rm -rf vim vim_faq
+
+jekyll-build-prepare:
+ mkdir -p $(JEKYLL_WORKDIR)
+ cp target/html/doc/*.html $(JEKYLL_WORKDIR)
+ cp -Ru src/* $(JEKYLL_WORKDIR)
+
+jekyll-build: jekyll-build-prepare
+ jekyll build -s $(JEKYLL_WORKDIR) -d $(JEKYLL_OUTDIR)
+
+jekyll-build-by-docker: jekyll-build-prepare
+ ./tools/docker_jekyll jekyll build -s $(JEKYLL_WORKDIR) -d $(JEKYLL_OUTDIR)
+
+jekyll-clean:
+ rm -rf $(JEKYLL_WORKDIR) $(JEKYLL_OUTDIR)
+
+.PHONY: jekyll-build-prepare jekyll-build jekyll-build-by-docker jekyll-clean
diff --git a/README.md b/README.md
index e8b5331c..908c0ed0 100644
--- a/README.md
+++ b/README.md
@@ -6,3 +6,16 @@ There is already another similar site: