-
Notifications
You must be signed in to change notification settings - Fork 8
85 lines (84 loc) · 2.59 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
name: Release
on:
workflow_dispatch:
# schedule:
# - cron: "0 0 * * 0" # At 00:00 on Sunday (weekly)
env:
BASE: /
USER: study-deploy
SERVER: studyathome.technikum-wien.at
DEST: /var/www/html/hub-public
SSH_OPTS: -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get Code
uses: actions/checkout@v3
- name: Install NodeGit Build Dependencies
run: sudo apt install libkrb5-dev
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.5.1
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
env:
NODE_OPTIONS: --openssl-legacy-provider
- name: Upload Build Result
uses: actions/upload-artifact@v3
with:
name: hub
path: build
deploy:
runs-on: ubuntu-latest
needs: build
env:
PASS: ${{ secrets.DEPLOY_USER_KEY }}
steps:
- name: Download Build Result
uses: actions/download-artifact@v3
with:
name: hub
# - name: Check Prerelease
# id: prerelease
# run: echo "exists=$(sshpass -p ${PASS} ssh ${SSH_OPTS} ${USER}@${SERVER} "if [ -d ${DEST}/next ]; then echo 'true'; else echo 'false'; fi")" >> $GITHUB_OUTPUT
# - name: Download Prerelease
# if: ${{ steps.prerelease.outputs.exists == 'true' }}
# run: sshpass -p ${PASS} scp ${SSH_OPTS} -r ${USER}@${SERVER}:${DEST}/next next
# DANGER:
# - name: Delete Content from Server
# run: sshpass -p ${PASS} ssh ${SSH_OPTS} ${USER}@${SERVER} "echo rm -rf ${DEST}/*"
#- name: Upload Build to StudyATHome Server
# run: sshpass -p ${PASS} scp ${SSH_OPTS} -r * ${USER}@${SERVER}:${DEST}/
- name: Upload Files
id: upload
uses: Creepios/[email protected]
with:
host: ${{ env.SERVER}}
port: 2222
username: ${{ env.USER}}
password: ${{ secrets.DEPLOY_USER_KEY }}
localPath: './'
remotePath: './html/hub-public/'
# We don't know when the site will be deployed, we just wait a few seconds
# Better solutions can be found
delay:
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Delay for 120 seconds
run: sleep 120s
algolia:
needs: [deploy, delay]
uses: ./.github/workflows/algolia.yml
with:
delete_index: true
secrets: inherit