~xdavidwu/xdavidwu.link

ref: 9110584992c3aa536a0fcc877faa477cfcfc03cc xdavidwu.link/.gitlab-ci.yml -rw-r--r-- 2.1 KiB
91105849xdavidwu ci: deploy to our pagessrht instance 1 year, 7 months ago
                                                                                
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
variables:
  GIT_SUBMODULE_STRATEGY: recursive

gemini:
  stage: build
  image: alpine:latest
  before_script:
    - apk add py3-pip
    - pip3 install md2gemini
    - find /lib /usr/lib ~/ -name 'renderers.py' -exec sed -i -E 's/text\.rstrip\(\)\.endswith\("\[" \+ str\(self\.footnote_num\) \+ "\]"\)/False/' {} \;
  script:
    - cd _posts
    - >
      for i in $(ls -r *.md);do
        OIFS="$IFS"
        IFS=$'\n'
        mv "$i" "${i}.orig"
        while read LINE;do
          F=$(echo "$LINE" | sed 's/^{% include_relative \(.*\) %}$/\1/')
          if [ -f "$F" ];then
            cat "$F" >> "$i"
          else
            printf "%s\n" "$LINE" >> "$i"
          fi
        done < "${i}.orig"
        IFS=$OIFS
        echo "=> $(echo $i | sed s/\.md$/.gmi/) $(echo $i | cut -f 1-3 -d '-'): $(grep '^title:' $i | cut -f 2 -d \")" >> ../gemini/index.gmi
      done
    - md2gemini -w -d ../gemini -a -f -i tab -l paragraph *.md
  artifacts:
    paths:
      - gemini

pages:
  stage: build
  image: ruby:alpine
  variables:
    JEKYLL_ENV: production
    LC_ALL: "C.UTF-8"
  before_script:
    - apk add npm
    - npm ci
    - npm run copy-vendor
    - bundle check --path .bundler || apk add git make gcc musl-dev g++
    - mkdir -p .bundler
    - bundle install -j $(nproc) --path .bundler
  script:
    - bundle exec rougify style base16.solarized.dark | sed 's/002b36/202124/g' >> _sass/minimal-mistakes/skins/_custom.scss
    - bundle exec rougify style base16.solarized.light >> _sass/minimal-mistakes/skins/_custom-light.scss
    - bundle exec jekyll build
  artifacts:
    paths:
      - _site
  cache:
    paths:
      - .bundler

deploy:
  stage: deploy
  image: alpine:latest
  before_script:
    - apk add curl
  script:
    - tar -C gemini -cvz . > gemini.tar.gz
    - tar -C _site -cvz . > https.tar.gz
    - curl --oauth2-bearer "$SRHT_PAT" -Fcontent=@gemini.tar.gz -Fprotocol=GEMINI https://pages.xdavidwu.link/publish/xdavidwu.link
    - curl --oauth2-bearer "$SRHT_PAT" -Fcontent=@https.tar.gz -Fprotocol=HTTPS https://pages.xdavidwu.link/publish/xdavidwu.link
  only:
    - master