forked from blockscout/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.77 KB
/
deploy.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
name: Deploy
on:
push:
branches: [ "devops/testnet_v2" ]
jobs:
build:
environment: testnet_v2
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create Image Tarball for explorer-frontend
run: |
mkdir -p artifacts
docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) --tag explorer-frontend .
docker save --output artifacts/explorer-frontend.tar explorer-frontend
- name: Create Image Tarball for nginx
run: |
docker build --tag nginx-explorer docker/nginx
docker save --output artifacts/nginx-explorer.tar nginx-explorer
- name: Set up SSH
run: |
mkdir -p ~/.ssh/
touch ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.EXPLORER_HOST }} >> ~/.ssh/known_hosts
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent)
- name: Copy Files to Server
run: |
scp -r artifacts/* ${{ secrets.HOST_USER}}@${{ secrets.EXPLORER_HOST }}:/blockscout
scp -r deploy/* ${{ secrets.HOST_USER}}@${{ secrets.EXPLORER_HOST }}:/blockscout
- name: SSH into Server and Deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.EXPLORER_HOST }}
username: ${{ secrets.HOST_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /blockscout
docker load --input explorer-frontend.tar
docker load --input nginx-explorer.tar
docker compose down
docker compose pull
docker compose up --detach --build --remove-orphans