-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin-project.yml
More file actions
129 lines (111 loc) · 4.58 KB
/
plugin-project.yml
File metadata and controls
129 lines (111 loc) · 4.58 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Deploy to server
permissions:
id-token: write
contents: read
on:
workflow_dispatch:
inputs:
ENVIRONMENT:
type: choice
description: "Target Environment"
required: true
default: "staging"
options:
- staging
- production
push:
branches:
- staging
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
context:
name: Setup context - ${{ inputs.ENVIRONMENT != '' && inputs.ENVIRONMENT || 'staging' }}
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT != '' && inputs.ENVIRONMENT || 'staging' }}
outputs:
environment: ${{ inputs.ENVIRONMENT != '' && inputs.ENVIRONMENT || 'staging' }}
steps:
- id: get
run: |
echo "environment=${{ inputs.ENVIRONMENT }}" >> "$GITHUB_OUTPUT"
build-and-push:
name: Build and push
runs-on: ubuntu-latest
environment: ${{ needs.context.outputs.environment }}
needs: [context]
steps:
- name: Setup WordPress
uses: infinum/eightshift-deploy-actions-public/.github/actions/setup/wordpress@main
with:
PHP_VERSION: "8.3"
WORDPRESS_GH_ACTIONS: ${{ secrets.WORDPRESS_GH_ACTIONS }}
- name: Setup custom secrets as environment variables
shell: bash
run: |
wp config set AUTH_KEY '${{ secrets.AUTH_KEY }}'
wp config set SECURE_AUTH_KEY '${{ secrets.SECURE_AUTH_KEY }}'
wp config set LOGGED_IN_KEY '${{ secrets.LOGGED_IN_KEY }}'
wp config set NONCE_KEY '${{ secrets.NONCE_KEY }}'
wp config set AUTH_SALT '${{ secrets.AUTH_SALT }}'
wp config set SECURE_AUTH_SALT '${{ secrets.SECURE_AUTH_SALT }}'
wp config set LOGGED_IN_SALT '${{ secrets.LOGGED_IN_SALT }}'
wp config set NONCE_SALT '${{ secrets.NONCE_SALT }}'
wp config set WP_CACHE_KEY_SALT '${{ secrets.WP_CACHE_KEY_SALT }}'
wp config set WP_ENVIRONMENT_TYPE '${{ needs.context.outputs.environment }}'
- name: Set special constants
uses: infinum/eightshift-deploy-actions-public/.github/actions/set/special-constants@main
- name: Install all plugins
uses: infinum/eightshift-deploy-actions-public/.github/actions/plugins/install@main
with:
WORDPRESS_GH_ACTIONS: ${{ secrets.WORDPRESS_GH_ACTIONS }}
- name: Install plugin
uses: infinum/eightshift-deploy-actions-public/.github/actions/setup/theme-or-plugin@main
with:
PROJECT_PATH: wp-content/plugins/<plugin_name>
USE_BUN: true
- name: Set cache
uses: infinum/eightshift-deploy-actions-public/.github/actions/set/cache@main
with:
PROJECT_PATH: wp-content/plugins/<plugin_name>
- name: Update version number
uses: infinum/eightshift-deploy-actions-public/.github/actions/set/version-plugin@main
with:
PROJECT_PATH: wp-content/plugins/<plugin_name>
- name: Setup real database constants
shell: bash
run: |
wp config set DB_NAME '${{ secrets.DB_NAME }}'
wp config set DB_USER '${{ secrets.DB_USER }}'
wp config set DB_PASSWORD '${{ secrets.DB_PASSWORD }}'
wp config set DB_HOST '${{ secrets.DB_HOST }}'
- name: Post install cleanup - root
uses: infinum/eightshift-deploy-actions-public/.github/actions/cleanup/root@main
- name: Post install cleanup - project
uses: infinum/eightshift-deploy-actions-public/.github/actions/cleanup/project@main
with:
PROJECT_PATH: wp-content/plugins/<plugin_name>
- name: Setup correct folder/file permissions
uses: infinum/eightshift-deploy-actions-public/.github/actions/set/permissions@main
- name: Deploy to server
uses: infinum/eightshift-deploy-actions-public/.github/actions/ssh/server-deploy@main
with:
SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }}
SERVER_USER: ${{ secrets.SERVER_USER }}
SERVER_HOST: ${{ secrets.SERVER_HOST }}
SERVER_ROOT: ${{ secrets.SERVER_ROOT }}
SERVER_PORT: ${{ secrets.SERVER_PORT }}
SSM_DEPLOY: true
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ROLE: ${{ secrets.AWS_ROLE }}
notify:
name: Notify
runs-on: ubuntu-latest
environment: ${{ needs.context.outputs.environment }}
needs: [context, build-and-push]
steps:
- name: Notify
uses: infinum/eightshift-deploy-actions-public/.github/actions/slack-notification@main
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}