-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (72 loc) · 2.24 KB
/
main.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
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
86
87
88
name: Frontend React Build
on:
pull_request: {}
push:
branches:
- main
concurrency:
group: '${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.ref }}'
cancel-in-progress: ${{ !contains(github.ref, 'main') }}
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install
- name: Linter
run: npm run lint
- name: Production Build
run: npm run build
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs: [validate]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
push: true
tags: starmordar/homm3-battle:latest
file: .ci/Dockerfile
context: .
release:
name: Release
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, 'release-frontend') }}
needs: deploy
env:
image-name: homm3-main
steps:
- name: Copy frontend to ngnix
uses: appleboy/[email protected]
with:
host: ${{ secrets.APP_HOST }}
username: ${{ secrets.SSH_HOST_USERNAME }}
password: ${{ secrets.SSH_HOST_PASSWORD }}
script: |
docker pull starmordar/homm3-battle:latest
docker stop ${{ env.image-name }}
docker rm -f ${{ env.image-name }}
docker run --restart=always --name ${{ env.image-name }} -d -p 80:80 starmordar/homm3-battle:latest