-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (66 loc) · 2.21 KB
/
build.yml
File metadata and controls
78 lines (66 loc) · 2.21 KB
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
name: Build Release
on:
push:
branches:
- 'release'
jobs:
wordpress:
name: Release
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: mysqli, xmlwriter
coverage: none
tools: composer:v2
- name: Get Composer Cache Directory
id: composer-cache-dir
run: |
echo "DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache PHP Dependencies
id: composer-cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache-dir.outputs.DIR }}
key: ${{ runner.os }}-composer-7.4-${{ hashFiles('composer.lock') }}
- name: Install PHP Dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "DIR=$(npm config get cache)" >> $GITHUB_OUTPUT
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_OUTPUT
echo "NODE_VERSION=$(node -v)" >> $GITHUB_OUTPUT
- name: Cache JS Dependencies
id: npm-cache
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.DIR }}
key: ${{ runner.os }}-npm-${{ steps.npm-cache-dir.outputs.NODE_VERSION }}-${{ steps.npm-cache-dir.outputs.NPM_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: Install JS Dependencies
run: npm install --legacy-peer-deps
- name: Build Assets
run: npm run build
- name: Setup
run: 'echo "VERSION=$(grep -Po ''\"version\": \"[0-9\\.]+\"'' package.json | grep -Po ''[0-9\\.]+'')" >> $GITHUB_ENV'
- name: Tag
run: |
echo "Releasing version $VERSION ..."
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b "release-$VERSION"
git add -f build/*
git add -f lib/*
git commit -m "Release $VERSION"
git tag "$VERSION"
git push --tags
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}