-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 1.4 KB
/
prod.yml
File metadata and controls
48 lines (42 loc) · 1.4 KB
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
name: Production build
on:
push:
branches:
- master
env:
SERVICE_NAME: magic-circle_frontend
IMAGE_NAME: ghcr.io/rtuitlab/magic-circle/frontend
jobs:
build_push_image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build image
run: docker build . --file deploy/Dockerfile --tag $IMAGE_NAME
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
docker tag $IMAGE_NAME $IMAGE_NAME:latest
docker tag $IMAGE_NAME $IMAGE_NAME:${{ github.run_number }}
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:${{ github.run_number }}
update_service:
needs: [build_push_image]
runs-on: ubuntu-latest
steps:
- name: Update service
uses: appleboy/ssh-action@master
env:
IMAGE: ${{ env.IMAGE_NAME }}:${{ github.run_number }}
SERVICE: ${{ env.SERVICE_NAME }}
with:
host: ${{ secrets.RTUITLAB_MANAGER_VM_HOST }}
username: ${{ secrets.RTUITLAB_MANAGER_VM_USERNAME }}
key: ${{ secrets.RTUITLAB_MANAGER_VM_SSH_KEY }}
envs: IMAGE,SERVICE
script: docker service update --image $IMAGE $SERVICE --with-registry-auth