forked from woocommerce/woocommerce-paypal-payments
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (45 loc) · 1.55 KB
/
package.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
name: Build package
on:
workflow_dispatch:
inputs:
packageVersion:
description: 'Package version'
required: false
type: string
filePrefix:
description: 'File prefix'
required: false
type: string
jobs:
package:
runs-on: ubuntu-latest
env:
PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }}
FILENAME: woocommerce-paypal-payments
name: Build package
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
- name: Fix plugin version input # Add the version number if only suffix entered
run: echo "PACKAGE_VERSION=$(sed -nE '/Version:/s/.* ([0-9.]+).*/\1/p' woocommerce-paypal-payments.php)-$PACKAGE_VERSION" >> $GITHUB_ENV
if: env.PACKAGE_VERSION && !contains(env.PACKAGE_VERSION, '.')
- name: Set plugin version header
run: 'sed -Ei "s/Version: .*/Version: ${PACKAGE_VERSION}/g" woocommerce-paypal-payments.php'
if: env.PACKAGE_VERSION
- name: Build
run: yarn build
- name: Unzip # GH currently always zips, so if we upload a zip we get a zip inside a zip
run: unzip woocommerce-paypal-payments.zip -d dist
- name: Set file name
env:
FILE_PREFIX: ${{ github.event.inputs.filePrefix }}
run: echo "FILENAME=$FILE_PREFIX-$FILENAME" >> $GITHUB_ENV
if: github.event.inputs.filePrefix
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.FILENAME }}
path: dist/