-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (34 loc) · 1014 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
33
34
35
name: Deploy
run-name: Deploy to ${{ inputs.deploy_env }}
on:
workflow_dispatch:
inputs:
git_ref:
default: latest
required: true
description: Deploy version
deploy_env:
type: choice
default: PRODUCTION
description: Deploy enviroment
options:
- PRODUCTION
jobs:
deploy:
name: Deploy To ${{ github.event.inputs.deploy_env }}
runs-on: [self-hosted, linux, x64, "${{ github.event.inputs.deploy_env }}"]
steps:
- name: Deploy
uses: actions/checkout@v3
if: github.event.inputs.git_ref == 'latest'
- name: Rollback
uses: actions/checkout@v3
if: github.event.inputs.git_ref != 'latest'
with:
ref: ${{ github.event.inputs.git_ref }}
- name: Install dependencies
run: npm i
- name: Build hugo
run: hugo
- name: ${{ github.event.inputs.deploy_env }} app restart
run: pm2 restart BLOG --log-date-format 'DD-MM-YYYY HH:mm:ss'