-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (47 loc) · 2.07 KB
/
deploy.yml
File metadata and controls
55 lines (47 loc) · 2.07 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
name: Deploy Plugin
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup SVN
run: sudo apt-get update && sudo apt-get install subversion
- name: Get Plugin Version
id: get_version
run: |
# Estrai la versione dal file principale del plugin
VERSION=$(grep -i 'Version:' plugin/easy-basic-authentication.php | awk '{print $2}')
echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV
- name: Get Git Commit Message
id: get_commit_message
run: |
# Recupera il messaggio di commit più recente da Git
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
- name: Checkout SVN repository
run: |
# Checkout del repository SVN
svn checkout --depth immediates https://plugins.svn.wordpress.org/easy-basic-authentication --username ${{ secrets.SVN_USERNAME }} --password ${{ secrets.SVN_PASSWORD }}
cd easy-basic-authentication
svn update trunk --set-depth infinity
svn update tags --set-depth infinity
svn update assets --set-depth infinity
- name: Sync with SVN trunk and assets
run: |
# Copia i file del plugin dal repository GitHub alla cartella trunk di SVN
rsync -av --delete --exclude='.git*' plugin/ easy-basic-authentication/trunk/
rsync -av --delete --exclude='.git*' assets/ easy-basic-authentication/assets/
cd easy-basic-authentication
# Aggiungi nuovi file e rimuovi quelli eliminati
svn add --force .
# Identifica i file eliminati e rimuovili da SVN
for file in $(svn status | grep '^!' | awk '{print $2}'); do svn delete "$file"; done
# Crea una nuova tag in SVN
svn cp trunk tags/${{ env.PLUGIN_VERSION }}
# Esegui il commit delle modifiche con il messaggio di commit di Git
svn commit -m "${{ env.COMMIT_MESSAGE }}" --username ${{ secrets.SVN_USERNAME }} --password ${{ secrets.SVN_PASSWORD }}