-
Notifications
You must be signed in to change notification settings - Fork 20
88 lines (79 loc) · 2.56 KB
/
dokku-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
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
name: Reusable Workflow - Deploy Dokku
on:
workflow_call:
inputs:
app_name:
required: true
type: string
description: Dokku Original App Name
branch:
required: true
type: string
description: Branch to be deployed
is_review_app:
default: false
required: false
type: boolean
description: Flag if this is a review app or not
pr_number:
required: false
type: string
description: Pull Request Number
secrets:
github_pat_token:
required: true
server:
required: true
ssh_private_key:
required: true
slack_webhook:
required: true
jobs:
deploy_dokku:
runs-on: ubuntu-latest
steps:
- name: Cloning repo
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ inputs.branch }}
- name: Set common variables
uses: moderntribe/actions/utils/common-variables@v1
with:
app_name: ${{ inputs.app_name }}
base_branch: ${{ inputs.branch }}
pr_number: ${{ inputs.pr_number }}
- name: Setup SSH
uses: moderntribe/actions/utils/ssh-agent@v1
with:
ssh_private_key: ${{ secrets.ssh_private_key }}
server: ${{ secrets.server }}
- name: Build Node
uses: moderntribe/actions/square1/build-node@v1
- name: Commit Files Node Files
uses: moderntribe/actions/utils/commit-files@v1
with:
folder: ./wp-content/
- name: Define app to deploy
id: define_app
run: |
if [[ ${{ inputs.is_review_app }} == "true" ]]; then
echo "deploy_app=${{ env.REVIEW_APP }}" >> "$GITHUB_OUTPUT"
else
echo "deploy_app=${{ inputs.app_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Deploy to ${{ steps.define_app.outputs.deploy_app }}
uses: moderntribe/actions/deploy/gitdeploy@v1
with:
git_url: "dokku@${{ secrets.server }}:${{ steps.define_app.outputs.deploy_app }}"
branch: ${{ env.BRANCH }}
- name: Slack Notification
if: success()|| failure() || cancelled()
uses: moderntribe/actions/utils/slack-message-deploy@v1
with:
branch: ${{ env.BRANCH }}
environment: ${{ steps.define_app.outputs.deploy_app }}
slack_webhook_url: ${{ secrets.slack_webhook }}
app_url: "${{ steps.define_app.outputs.deploy_app }}.${{ secrets.server }}"
gha_url: ${{ env.GHA_URL }}
status: ${{ job.status }}