-
Notifications
You must be signed in to change notification settings - Fork 5
165 lines (158 loc) · 5.11 KB
/
stable.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Stable
on:
push:
tags:
- '*'
jobs:
# Builds the package and creates artifact with dist files
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
- name: Install Node dependencies
uses: bahmutov/npm-install@v1
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
with:
composer-options: "--no-dev"
- name: Build static assets
run: yarn build
- name: Create build dir
run: mkdir build
- name: Copy files
uses: Pendect/[email protected]
env:
DEPLOY_KEY: ${{ secrets.PACKAGES_DEPLOY_KEY }}
with:
flags: '-avq'
options: '--exclude-from=".build-excludes"'
src: '.'
dest: 'build'
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: build
path: build
# Creates the stable package artifact when tag is created
pack:
name: Pack
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup variables
id: vars
run: |
echo "::set-output name=package-name::${{ secrets.SLUG }}-${GITHUB_REF#refs/tags/}"
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: build
path: ${{ secrets.SLUG }}
- name: Create archive
run: |
zip -rq ${{ steps.vars.outputs.package-name }}.zip ${{ secrets.SLUG }}
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: ${{ steps.vars.outputs.package-name }}
path: ${{ steps.vars.outputs.package-name }}.zip
# Uploads the stable package to internal repository
upload:
name: Upload to repo
runs-on: ubuntu-latest
needs: pack
steps:
- name: Setup variables
id: vars
run: |
echo "::set-output name=package-name::${{ secrets.SLUG }}-${GITHUB_REF#refs/tags/}"
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ steps.vars.outputs.package-name }}
path: .
- name: Upload to repo
uses: Pendect/[email protected]
env:
DEPLOY_KEY: ${{ secrets.PACKAGES_DEPLOY_KEY }}
with:
flags: '-avz'
options: '--recursive '
src: '.'
dest: '${{ secrets.BRACKETSPACE_REPO_RSYNC_URL }}${{ secrets.SLUG }}/'
# Release on GitHub
github-release:
name: Release on GitHub
runs-on: ubuntu-latest
needs: pack
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup variables
id: vars
run: |
echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
echo "::set-output name=package-name::${{ secrets.SLUG }}-${GITHUB_REF#refs/tags/}"
- name: Parse changelog
run: |
START="= ${{ steps.vars.outputs.version }} ="
END="= [0-9]+.[0-9]+.[0-9]+ =|==|\$"
grep -oPz "(?s)${START}.*?\n\K.*?(?=${END})" readme.txt > changelog.txt
truncate -s-2 changelog.txt
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ steps.vars.outputs.package-name }}
path: .
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: changelog.txt
files: ${{ steps.vars.outputs.package-name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Deploys the stable tag to WordPress.org repository
wordpress-org-release:
name: Release on WordPress.org
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '12'
- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
- name: Install Node dependencies
uses: bahmutov/npm-install@v1
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
with:
composer-options: "--no-dev"
- name: Create .distignore file
run: cp .build-excludes .distignore
- name: Remove obsolete files
run: rm -rf .build-excludes .gitignore
- name: Deploy to WordPress repository
uses: 10up/[email protected]
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: ${{ secrets.SLUG }}