-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (52 loc) · 1.69 KB
/
deploy.yaml
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
on:
push:
branches:
- master
jobs:
build:
name: Build website .tar.gz
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build .tar.gz file
run: |
docker build --tag local-img/zipper --target zipper .
docker create --name zipper local-img/zipper
docker cp zipper:/build.tar.gz ./build.tar.gz
docker rm -f zipper
shell: bash
- uses: actions/upload-artifact@v4
with:
name: build-tar-gz
path: ./build.tar.gz
deploy:
name: Deploy website to Strato
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build-tar-gz
- name: Apt install sshpass
run: |
sudo apt-get update
sudo apt-get -y install sshpass
- name: Upload to Strato
env:
SSHPASS: ${{ secrets.STRATO_SSH_PASSWORD }}
run: |
sshpass -e scp -oStrictHostKeyChecking=no ./build.tar.gz ${{ secrets.STRATO_SSH_USERNAME }}@ssh.strato.com:build.tar.gz
sshpass -e ssh -oStrictHostKeyChecking=no ${{ secrets.STRATO_SSH_USERNAME }}@ssh.strato.com << EOF
rm -rf ./new-release
mkdir new-release
cd new-release
tar -xzvf ../build.tar.gz
cd ..
rm -f ./build.tar.gz
echo "IFTTT_KEY=${{ secrets.IFTTT_KEY }}" > ./new-release/.env
echo "MAIL_ORDERS_TO=${{ secrets.MAIL_ORDERS_TO }}" >> ./new-release/.env
rm -rf ./prev-release
mv ./app ./prev-release
mv ./new-release ./app
rm -rf ./new-release
EOF