-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (25 loc) · 1001 Bytes
/
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
name: Docker Image deployment
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build_api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get EDUMGT-API version from package.json
run: echo "CLIENT_PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Build Docker Image
run: docker build -t edumgt-api:latest -t edumgt-api:${{ env.CLIENT_PACKAGE_VERSION }} .
- name: Setup key
run: |
set -eu
mkdir "$HOME/.ssh"
echo "${{ secrets.STAGE_ID_RSA }}" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
- name: Deploy Docker Container
run: |
docker save edumgt-api | ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no ${{ secrets.STAGE_SERVER_USER }}@${{ secrets.STAGE_SERVER_IP }} -p ${{ secrets.STAGE_SERVER_PORT }} 'docker load'