-
Notifications
You must be signed in to change notification settings - Fork 53
118 lines (116 loc) · 3.41 KB
/
main.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Deploy main
on:
push:
branches:
- main
- release-2.3
tags:
- '2.*'
jobs:
releasenew:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install Dependencies
run: npm ci
- name: Fix site prefix
run: |
sed -i -e "s|'/2.4'|'/${{ github.ref_name }}'|" .vitepress/config.js
- name: Build with VitePress
run: |
mkdir mans
npm run docs:build
npm run man:build core mans/core
npm run man:build pigeonhole mans/pigeonhole
- name: Prepare tarballs
run: |
mkdir tars
tar --transform=s,.vitepress/dist,html/${{ github.ref_name }}, -cJf tars/docs.txz .vitepress/dist
for dir in mans/*; do
tag=$(basename $dir)
tar --transform=s,${dir},man, '--exclude=_*' '--exclude=.*' -cJf tars/$tag.txz $dir
done
mv tars/* .vitepress/dist/
- name: Deploy to doc.dovecot.org
uses: dovecot/rsync-deployments@v2.0.2
with:
FLAGS: -azr --delete
HOST: doc.dovecot.org
USER: docs
LOCALPATH: /.vitepress/dist/.
REMOTEPATH: public_html/${{ github.ref_name }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
if: env.DEPLOY_KEY
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
- name: Fix symlinks
run: |
mkdir -p $HOME/.ssh
chmod 0700 $HOME/.ssh
echo "$DEPLOY_KEY" > $HOME/.ssh/deploy_key
chmod 0600 $HOME/.ssh/deploy_key
ssh -i $HOME/.ssh/deploy_key -o StrictHostKeyChecking=no docs@doc.dovecot.org bash update-ce-links.sh
rm $HOME/.ssh/deploy_key
if: env.DEPLOY_KEY
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
- name: Prepare gzip tarball for GitHub download
run: |
tar --transform=s,.vitepress/dist,html/${{ github.ref_name }}, -czf tars/docs.tgz .vitepress/dist
- name: Upload tarball artifact
uses: actions/upload-artifact@v4
with:
name: documentation-tar
path: tars/docs.tgz
publishnew:
runs-on: ubuntu-latest
needs: releasenew
if: github.ref == 'refs/heads/main'
name: Publish documentation tarball
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: documentation-tar
path: ./
- name: Generate SHA256 checksum
run: |
sha256sum docs.tgz > SHA256SUMS.txt
- name: List files
run: ls -rl
- name: Update latest release
uses: andelf/nightly-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: latest
name: 'Latest Documentation Build'
draft: false
body: |
This is a gzipped tarball of the latest documentation build.
files: |
./SHA256SUMS.txt
./docs.tgz
release23:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/release-2.3'
steps:
- uses: actions/checkout@v4
- uses: dovecot/dovecot-sphinx-action@0.11
- uses: dovecot/rsync-deployments@v2.0.2
with:
FLAGS: -azr --delete
HOST: doc.dovecot.org
USER: docs
LOCALPATH: /build/.
REMOTEPATH: public_html/2.3
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
if: env.DEPLOY_KEY
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}