Add GH Action for building package

This commit is contained in:
Alex P 2022-07-29 15:51:05 +03:00
parent 061ca9e7fd
commit 706ff246da
2 changed files with 44 additions and 0 deletions

41
.github/workflows/package.yml vendored Normal file
View file

@ -0,0 +1,41 @@
name: Build package

on:
workflow_dispatch:
inputs:
packageVersion:
description: 'Package Version'
required: false
type: string

jobs:
package:
runs-on: ubuntu-latest

name: Build package
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
tools: composer:v1

- name: Set plugin version header
env:
PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }}
run: 'sed -Ei "s/Version: .*/Version: ${PACKAGE_VERSION}/g" woocommerce-paypal-payments.php'
if: github.event.inputs.packageVersion

- 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: Upload
uses: actions/upload-artifact@v3
with:
name: woocommerce-paypal-payments
path: dist/