-
Notifications
You must be signed in to change notification settings - Fork 23
159 lines (138 loc) · 4.55 KB
/
release-legacy-v4.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
###
# Only kept right now for bugfixes and security patches.
###
name: '🚀 Release [LEGACY v4]'
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to release (Use workflow from main!)'
required: true
default: 'v4'
deploy-svn:
type: boolean
description: 'Deploy to SVN'
required: false
default: true
concurrency:
group: release-legacy-${{ github.ref }}
cancel-in-progress: true
env:
PHP_VERSION: 7.1
NODE_VERSION: 18
ASSETS_DIR: ./.wordpress-assets
BUILD_DIR: ./.wordpress-dist
jobs:
release:
runs-on: ubuntu-22.04
outputs:
released: ${{ steps.release.outputs.released }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: myparcelnl/actions/setup-git-credentials@v4
id: credentials
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
fetch-depth: 0
token: ${{ steps.credentials.outputs.token }}
- uses: myparcelnl/actions/create-cache-keys@v4
id: cache-keys
with:
key: ${{ format('{0}{1}-legacy-cache', runner.os, runner.arch) }}
input: |
${{ hashFiles('**/yarn.lock', '**/composer.lock') }}
${{ hashFiles('**/*.php', 'includes/**', 'src/**', 'templates/**', 'migration/**') }}
- uses: actions/cache@v4
id: cache
with:
path: |
node_modules
vendor
key: ${{ steps.cache-keys.outputs.key }}
restore-keys: ${{ steps.cache-keys.outputs.restore-keys }}
- uses: myparcelnl/actions/composer-install@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
php-version: ${{ env.PHP_VERSION }}
- uses: myparcelnl/actions/yarn-install@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
node-version: ${{ env.NODE_VERSION }}
- uses: myparcelnl/actions/semantic-release@v4
id: release
with:
token: ${{ steps.credentials.outputs.token }}
semantic-release-args: --branch ${{ inputs.branch }}
deploy-svn:
needs: release
if: needs.release.outputs.released == 'true' && inputs.deploy-svn == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- uses: myparcelnl/actions/create-cache-keys@v4
id: cache-keys
with:
key: ${{ format('{0}{1}-legacy-cache', runner.os, runner.arch) }}
input: |
${{ hashFiles('**/yarn.lock', '**/composer.lock') }}
${{ hashFiles('**/*.php', 'includes/**', 'src/**', 'templates/**', 'migration/**') }}
- uses: actions/cache@v4
id: cache
with:
path: |
node_modules
vendor
key: ${{ steps.cache-keys.outputs.key }}
restore-keys: ${{ steps.cache-keys.outputs.restore-keys }}
- uses: myparcelnl/actions/composer-install@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
php-version: ${{ env.PHP_VERSION }}
- uses: myparcelnl/actions/yarn-install@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Trim leading "v" from version number'
id: prepare
shell: bash
env:
VERSION: ${{ needs.release.outputs.version }}
#language=bash
run: |
echo "version=${VERSION#v}" >> $GITHUB_OUTPUT
- name: 'Create build'
shell: bash
env:
VERSION: ${{ steps.prepare.outputs.version }}
#language=bash
run: |
node ./private/updateVersion.cjs "${VERSION}"
yarn build
- name: 'Create dist folder'
shell: bash
#language=bash
run: |
bash ./private/bash/createDistFolder.sh "${BUILD_DIR}"
- uses: 10up/action-wordpress-plugin-deploy@stable
env:
SLUG: woocommerce-myparcel
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
VERSION: ${{ steps.prepare.outputs.version }}
rebase-prs:
needs:
- release
runs-on: ubuntu-22.04
steps:
- uses: myparcelnl/actions/rebase-prs@v4
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
base: ${{ inputs.branch }}
exclude-drafts: true