-
Notifications
You must be signed in to change notification settings - Fork 17
84 lines (66 loc) · 2.53 KB
/
cd-convert-debian-bookworm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: continuous deployment for gh-pages
on:
push:
branches:
- main
jobs:
build:
container: debian:bookworm
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: apt-get update && apt-get install -y wget git
- name: Fix broken dependencies
run: |
apt-get install -y --fix-missing
apt-get install -f -y
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Download release of TeXmacs
run: |
wget http://www.texmacs.org/Download/ftp/tmftp/Linux/Debian_12/TeXmacs-2.1.4.amd64.deb -O /tmp/texmacs.deb
DEBIAN_FRONTEND=noninteractive apt install -y /tmp/texmacs.deb
- name: Run TeXmacs script with headless option
run: |
# add safe directory (texmacs script uses git to obtain metadata)
git config --global --add safe.directory $PWD
# run texmacs scripts
texmacs_bin=$(which texmacs)
$texmacs_bin -headless -x '(begin (load "notes-tools.scm") (notes-update) (quit))'
- name: Commit changes to main and deploy to gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# set variable
TARGET_BRANCH="gh-pages"
BUILD_DIR="docs"
RESOURCES_DIR="resources"
ROOT_INDEX_FILE="index.html"
REPO_URL="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
# add safe directory
git config --global --add safe.directory $PWD
# set Git config
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
# commit & push to main
git add --all
git commit -m "CD build"
git push
# init gh-pages branch
git clone --branch ${TARGET_BRANCH} --depth 1 ${REPO_URL} gh-pages || \
(git init gh-pages && cd gh-pages && git checkout --orphan ${TARGET_BRANCH})
cd gh-pages
# remove old file
rm -rf *
# copy 'docs'
cp -r ../${BUILD_DIR} .
# copy 'resources'
cp -r ../${RESOURCES_DIR} .
# copy 'index.html'
cp ../${ROOT_INDEX_FILE} .
# commit & push
git add --all
git commit -m "Deploy to ${TARGET_BRANCH} branch"
git push --force ${REPO_URL} ${TARGET_BRANCH}