-
Notifications
You must be signed in to change notification settings - Fork 8
90 lines (85 loc) · 2.98 KB
/
release-workflow.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
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
name: Create release and deploy to W.org
on:
release:
types: [released, prereleased]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release-asset:
name: Create release asset
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer
- name: Install dependencies
run: |
npm install --silent
composer install --no-dev
- name: Run build steps
run: |
npm run build
composer dump-autoload -o
- name: Create deployment ZIP
run: |
mkdir -p lazy-loading-responsive-images
rsync -rav --exclude-from='.rsync-exclude' --delete-excluded ./ lazy-loading-responsive-images
zip -r lazy-loading-responsive-images.zip lazy-loading-responsive-images/
- name: Create artifact with files to deploy to W.org
uses: actions/upload-artifact@v2
with:
name: lazy-loading-responsive-images
path: lazy-loading-responsive-images
retention-days: 1
- name: Get Release
id: get_release
uses: bruceadams/[email protected]
- name: Upload ZIP to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./lazy-loading-responsive-images.zip
asset_name: lazy-loading-responsive-images.zip
asset_content_type: application/zip
wordpress-repo-deploy:
name: Deploy to W.org
needs: release-asset
runs-on: ubuntu-latest
if: github.event.action == 'released'
steps:
- name: Get release for version number
id: get_release
uses: bruceadams/[email protected]
- name: Set version env variable.
env:
TAG_NAME: ${{ steps.get_release.outputs.tag_name }}
run: echo "version=$(echo $TAG_NAME | sed -e 's/^v//')" >> $GITHUB_ENV
- name: Download the release artifact
id: download
uses: actions/download-artifact@v2
with:
name: lazy-loading-responsive-images
path: release-files
- name: Deploy to W.org
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_URL: ${{ secrets.SVN_URL }}
SVN_DIR: "svn-lazy-loading-responsive-images"
run: |
svn checkout --depth immediates "$SVN_URL" "$SVN_DIR"
cd "$SVN_DIR"
svn update --set-depth infinity trunk
rsync -rav "${{steps.download.outputs.download-path}}/" trunk/ --delete
svn add . --force > /dev/null
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %@ > /dev/null
svn cp "trunk" "tags/${{ env.version }}"
svn status
svn commit -m "Update to version ${{ env.version }} from GitHub" --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD"