mirror of
https://gh.wpcy.net/https://github.com/elementor/hello-theme.git
synced 2026-04-26 12:02:20 +08:00
47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
name: Build
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
jobs:
|
|
build_plugin:
|
|
name: Build theme
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18.x
|
|
- name: Cache node modules
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
${{ runner.os }}-build-
|
|
${{ runner.os }}-
|
|
- name: Install Dependencies
|
|
run: npm ci
|
|
- name: Bump version on push to release or develop
|
|
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/develop')
|
|
run: |
|
|
npm config set git-tag-version false
|
|
if [ "${GITHUB_REF:11}" == "develop" ];
|
|
then npm version patch
|
|
fi
|
|
if [[ "${GITHUB_REF:11:7}" == "release" ]];
|
|
then npm version minor
|
|
fi
|
|
- name: Build
|
|
run: npm run zip
|
|
- name: Upload zip file to GitHub actions artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: hello-elementor
|
|
path: hello-elementor.*.zip
|
|
retention-days: 7
|