Skip to content

Commit a1e2269

Browse files
author
Balazs P
committed
.org deploy mechanism
1 parent 4f75ed2 commit a1e2269

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# .github/workflows/deploy.yml
2+
name: Deploy to WordPress.org
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*' # triggers on tags like v1.2.3
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout GitHub repository
15+
uses: actions/checkout@v4
16+
17+
- name: Extract version from tag
18+
id: get_version
19+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
20+
21+
- name: Install Subversion
22+
run: sudo apt-get update && sudo apt-get install -y subversion
23+
24+
- name: Checkout WordPress.org SVN repo
25+
run: |
26+
svn checkout https://plugins.svn.wordpress.org/superdraft/ svn \
27+
--username "${{ secrets.SVN_USERNAME }}" \
28+
--password "${{ secrets.SVN_PASSWORD }}" \
29+
--non-interactive --trust-server-cert
30+
31+
- name: Sync trunk (exclude src folder)
32+
run: |
33+
# Sync everything except the src folder
34+
rsync -avz --delete --exclude 'src' . svn/trunk/
35+
# Add any new files to SVN
36+
svn add --force svn/trunk --auto-props --parents --depth infinity -q
37+
38+
- name: Sync assets to SVN root
39+
run: |
40+
# Sync assets folder to the SVN root assets folder
41+
rsync -avz --delete assets/ svn/assets/
42+
svn add --force svn/assets --auto-props --parents --depth infinity -q
43+
44+
- name: Show SVN status
45+
run: svn status svn
46+
47+
- name: Commit changes to trunk (and assets)
48+
run: |
49+
cd svn
50+
svn commit -m "Deploy version ${RELEASE_VERSION}" \
51+
--username "${{ secrets.SVN_USERNAME }}" \
52+
--password "${{ secrets.SVN_PASSWORD }}" \
53+
--non-interactive --trust-server-cert
54+
55+
- name: Create SVN tag for the release
56+
run: |
57+
cd svn
58+
svn copy trunk tags/${RELEASE_VERSION} \
59+
--username "${{ secrets.SVN_USERNAME }}" \
60+
--password "${{ secrets.SVN_PASSWORD }}" \
61+
--non-interactive --trust-server-cert
62+
svn commit -m "Tag version ${RELEASE_VERSION}" \
63+
--username "${{ secrets.SVN_USERNAME }}" \
64+
--password "${{ secrets.SVN_PASSWORD }}" \
65+
--non-interactive --trust-server-cert

0 commit comments

Comments
 (0)