-
Notifications
You must be signed in to change notification settings - Fork 2
128 lines (120 loc) · 4.23 KB
/
release.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
119
120
121
122
123
124
125
126
127
128
name: release
on:
push:
tags: ['*']
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
build-standalone:
runs-on: ubuntu-latest
env:
DOCS_BASE_URL: /kb/
DOCS_HOME_URL: /
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | sed -e 's/\./_/g') >> $GITHUB_OUTPUT
- name: Install
uses: wyvox/action-setup-pnpm@v3
- id: Optimize
run: pnpm optimize
- id: Build
run: pnpm build
- name: Pack
run: |
sed -i "s/__VERSION__/$(echo ${{ steps.get_version.outputs.VERSION }} | cut -c 2- | sed -e 's/_/./g' | sed -e 's/-/~/g')/g" deb/DEBIAN/control
sed -i "s/__INSTALLED_SIZE__/$(du -sk build | cut -f 1)/g" deb/DEBIAN/control
cat deb/DEBIAN/control
mkdir -p deb/usr/share/cloudpss/static/${{ env.DOCS_BASE_URL }}/
cp -a build/. deb/usr/share/cloudpss/static/${{ env.DOCS_BASE_URL }}/
dpkg-deb --build --root-owner-group -Zxz -z9 -Sextreme deb .
ls -l *.deb
- name: Upload Release Asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: '*.deb'
prerelease: ${{ contains(github.event.ref, '-') }}
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
build-public:
runs-on: ubuntu-latest
env:
DOCS_BASE_URL: /
DOCS_HOME_URL: https://cloudpss.net/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo VERSION=$(echo $GITHUB_REF | cut -d / -f 3 | sed -e 's/\./_/g') >> $GITHUB_OUTPUT
- name: Install
uses: wyvox/action-setup-pnpm@v3
- id: Optimize
run: pnpm optimize
- id: Build
run: pnpm build
- name: Precompress
run: pnpm gzipper compress --exclude jpeg,jpg,png,gif,ico,mp3,mp4,mkv,zip --brotli --remove-larger ./build
- name: Pack
run: |
XZ_OPT=-e9 tar -cJf dist.tar.xz -C ./build .
ls -l dist.tar.xz
- name: Upload Release Asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: dist.tar.xz
prerelease: ${{ contains(github.event.ref, '-') }}
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-deploy
uses: appleboy/[email protected]
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
script: rm -f /root/docs/dist.tar.xz
- name: Deploy
uses: appleboy/[email protected]
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
source: ./dist.tar.xz
target: /root/docs/
- name: Post-deploy
uses: appleboy/[email protected]
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
script: |
rm -rf /root/docs/${{ steps.get_version.outputs.VERSION }}
mkdir -p /root/docs/${{ steps.get_version.outputs.VERSION }}
tar -xJf /root/docs/dist.tar.xz -C /root/docs/${{ steps.get_version.outputs.VERSION }}
rm -f /root/docs/latest
ln -s /root/docs/${{ steps.get_version.outputs.VERSION }} /root/docs/latest
rm -f /root/docs/dist.tar.xz
systemctl reload caddy
ls -l /root/docs/
- name: Release
uses: appleboy/[email protected]
if: ${{ !contains(steps.get_version.outputs.VERSION, '-') }}
with:
host: ${{ vars.DC_HOST }}
port: ${{ vars.DC_PORT }}
username: ${{ vars.DC_USER }}
key: ${{ secrets.DC_KEY }}
script: |
rm -f /root/docs/release
ln -s /root/docs/${{ steps.get_version.outputs.VERSION }} /root/docs/release
systemctl reload caddy
ls -l