-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (60 loc) · 2.23 KB
/
Copy pathdeploy.yml
File metadata and controls
74 lines (60 loc) · 2.23 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
name: Deploy WordPress Theme
on:
push:
branches:
- main
jobs:
build:
name: Build, Tag and Publish Theme
runs-on: ubuntu-latest
permissions:
contents: write # Required to create tags and releases
steps:
- name: Checkout full history
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed to generate changelog using git log
- name: Set up Node (required for github-tag-action)
uses: actions/setup-node@v3
with:
node-version: 18
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch # Change to 'minor' or 'major' if needed
- name: Zip the theme
run: |
zip -r terminal-theme.zip . -x ".git*" ".github*" "node_modules*" "*.zip"
- name: Get commit messages since last tag
id: changelog
run: |
LAST_TAG=$(git describe --tags --abbrev=0)
echo "Last tag: $LAST_TAG"
LOG=$(git log $LAST_TAG..HEAD --pretty=format:"- %s (%an)")
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$LOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create GitHub Release and attach ZIP
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
name: terminal-theme ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.changelog.outputs.changelog }}
files: terminal-theme.zip
- name: Deploy clean theme via FTP
env:
FTP_USER: ${{ secrets.FTP_USERNAME }}
FTP_PASS: ${{ secrets.FTP_PASSWORD }}
run: |
mkdir deploy-clean
rsync -av --exclude=".git*" --exclude=".github" --exclude="node_modules" --exclude="*.zip" ./ deploy-clean/
sudo apt-get update
sudo apt-get install -y lftp
lftp -u "$FTP_USER","$FTP_PASS" open.hr -e "
set ftp:passive-mode true;
set ssl:verify-certificate no;
mirror -R --delete --verbose deploy-clean/ public_html/wp-content/themes/terminal-theme;
bye
"