-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.72 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Experimental workflow to test GitHub Actions.
name: Deploy
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
name: Deploy to Production
runs-on: ubuntu-20.04
environment:
name: production
url: https://purpleturtlecreative.com/
steps:
# Download All Code.
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PTC_GITHUB_PAT }}
# Build Completionist Pro.
- name: Completionist Pro - Build install
working-directory: ./wp-content/plugins/completionist-pro
run: ./build_install.sh
shell: bash
- name: Completionist Pro - Build cleanup
working-directory: ./wp-content/plugins/completionist-pro
run: ./build_cleanup.sh
shell: bash
# Remove unnecessary files and directories.
- name: Clean Up
run: |
find . -name '.git*' -exec rm -rf {} + -depth
find . -type d -empty -delete
# Upload Code to Production.
- name: Sync Code to Production
env:
remote: "github@${{ secrets.PTC_PROD_HOSTNAME }}"
destination: "/var/www/html"
run: |
echo "${{ secrets.PTC_GITHUB_SSH_KEY }}" > deploy_key
chmod 600 ./deploy_key
rsync --recursive --links --checksum --delete \
--exclude-from="./exclude.lst" \
-e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \
./wp-content ${{ env.remote }}:${{ env.destination }}
ssh -i ./deploy_key -o StrictHostKeyChecking=no ${{ env.remote }} 'chmod -R 775 ${{ env.destination }}/wp-content; chgrp -R www-data ${{ env.destination }}/wp-content' || true