-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (36 loc) · 1.26 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
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'
- name: Notify deployment
run: DEPLOY_ENV=${{ github.event.inputs.deploy_env}} NTFY_USER=${{ secrets.NTFY_USER }} NTFY_PASSWD=${{ secrets.NTFY_PASSWD }} NTFY_SERVER_URL=${{ secrets.NTFY_SERVER_URL }} PROJECT_NAME=${{ vars.PROJECT_NAME }} npm run notify:deploy