Skip to content

Commit 00360a2

Browse files
committed
Build and Deploy jobs
1 parent e7160a7 commit 00360a2

File tree

14 files changed

+232
-26
lines changed

14 files changed

+232
-26
lines changed

.github/workflows/code-quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
trufflehog:
8-
uses: ./.github/workflows/truffle-hog.yml
8+
uses: ./.github/workflows/jobs/truffle-hog.yml
99

1010
virus-scan:
11-
uses: ./.github/workflows/virus-scan.yml
11+
uses: ./.github/workflows/jobs/virus-scan.yml

.github/workflows/coding-standards.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55

66
jobs:
77
stylelint:
8-
uses: ./.github/workflows/stylelint.yml
8+
uses: ./.github/workflows/jobs/stylelint.yml
99

1010
eslint:
11-
uses: ./.github/workflows/eslint.yml
11+
uses: ./.github/workflows/jobs/eslint.yml
1212

1313
phpcs:
14-
uses: ./.github/workflows/phpcs.yml
14+
uses: ./.github/workflows/jobs/phpcs.yml
1515

1616
phpstan:
17-
uses: ./.github/workflows/phpstan.yml
17+
uses: ./.github/workflows/jobs/phpstan.yml

.github/workflows/develop.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Deploy to Develop
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
lint:
10+
uses: ./.github/workflows/jobs/coding-standards.yml
11+
12+
test:
13+
uses: ./.github/workflows/jobs/code-quality.yml
14+
15+
build:
16+
uses: ./.github/workflows/jobs/build.yml
17+
18+
deploy:
19+
uses: ./.github/workflows/jobs/deploy.yml
20+
with:
21+
name: develop
22+
url: https://develop.fueled.com

.github/workflows/jobs/build.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Install Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version-file: .nvmrc
21+
cache: "npm"
22+
23+
- name: Get npm cache directory
24+
id: npm-cache-dir
25+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
26+
27+
- name: Cache npm dependencies
28+
uses: actions/cache@v4
29+
with:
30+
path: ${{ steps.npm-cache-dir.outputs.dir }}
31+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-node-
34+
35+
- name: Check Node version
36+
run: node -v
37+
38+
- name: Setup NPM
39+
run: npm install -g npm@latest
40+
41+
- name: Check Node version
42+
run: npm -v
43+
44+
- name: Install Node dependencies
45+
run: npm install
46+
47+
- name: Build JavaScript
48+
run: npm run build
49+
50+
- name: Setup PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: "8.4"
54+
coverage: none
55+
tools: composer:v2
56+
57+
- name: Get Composer cache directory
58+
id: composer-cache
59+
run: echo "dir=$(composer config cache-files-dir)" >> ${GITHUB_OUTPUT}
60+
61+
- name: Cache Composer dependencies
62+
uses: actions/cache@v4
63+
with:
64+
path: ${{ steps.composer-cache.outputs.dir }}
65+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
66+
restore-keys: |
67+
${{ runner.os }}-composer-
68+
69+
- name: PHP Version
70+
run: php -v
71+
72+
- name: Install Root dependencies
73+
run: composer install --no-dev --prefer-dist --no-progress
74+
75+
- name: Install Plugin dependencies
76+
run: composer install --no-dev --prefer-dist --no-progress --working-dir=mu-plugins/10up-plugin
77+
78+
- name: Install Theme dependencies
79+
run: composer install --no-dev --prefer-dist --no-progress --working-dir=themes/10up-theme
80+
81+
- name: Upload build artifact
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: ${{ inputs.name }}-payload
85+
retention-days: 7
86+
include-hidden-files: true
87+
path: .
88+

.github/workflows/jobs/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
name:
7+
required: true
8+
type: string
9+
url:
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
deploy:
18+
runs-on: ubuntu-latest
19+
needs: build
20+
environment:
21+
name: ${{ inputs.name }}
22+
url: ${{ inputs.url }}
23+
24+
steps:
25+
- name: Download build artifact
26+
uses: actions/download-artifact@v4
27+
with:
28+
name: ${{ inputs.name }}-payload
29+
30+
# TODO: Implement deployment
31+

.github/workflows/eslint.yml renamed to .github/workflows/jobs/eslint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ jobs:
2020
node-version-file: .nvmrc
2121
cache: "npm"
2222

23-
- name: Cache node modules
23+
- name: Get npm cache directory
24+
id: npm-cache-dir
25+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
26+
27+
- name: Cache npm dependencies
2428
uses: actions/cache@v4
2529
with:
26-
path: ~/.npm
30+
path: ${{ steps.npm-cache-dir.outputs.dir }}
2731
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2832
restore-keys: |
2933
${{ runner.os }}-node-

.github/workflows/jest.yml renamed to .github/workflows/jobs/jest.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ jobs:
2020
node-version-file: .nvmrc
2121
cache: "npm"
2222

23-
- name: Cache node modules
23+
- name: Get npm cache directory
24+
id: npm-cache-dir
25+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
26+
27+
- name: Cache npm dependencies
2428
uses: actions/cache@v4
2529
with:
26-
path: ~/.npm
30+
path: ${{ steps.npm-cache-dir.outputs.dir }}
2731
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2832
restore-keys: |
2933
${{ runner.os }}-node-

.github/workflows/phpcs.yml renamed to .github/workflows/jobs/phpcs.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ jobs:
2929
- name: Validate Theme composer.json and composer.lock
3030
run: composer validate --strict --working-dir=themes/10up-theme
3131

32-
- name: Cache Composer packages
32+
- name: Get Composer Cache Directory
3333
id: composer-cache
34-
uses: actions/cache@v3
34+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
35+
36+
- name: Cache Composer dependencies
37+
uses: actions/cache@v4
3538
with:
36-
path: vendor
37-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
39+
path: ${{ steps.composer-cache.outputs.dir }}
40+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
3841
restore-keys: |
39-
${{ runner.os }}-php-
42+
${{ runner.os }}-composer-
4043
4144
- name: Install Root dependencies
4245
run: composer install --prefer-dist --no-progress

.github/workflows/phpstan.yml renamed to .github/workflows/jobs/phpstan.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ jobs:
2929
- name: Validate Theme composer.json and composer.lock
3030
run: composer validate --strict --working-dir=themes/10up-theme
3131

32-
- name: Cache Composer packages
32+
- name: Get Composer Cache Directory
3333
id: composer-cache
34+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
35+
36+
- name: Cache Composer dependencies
3437
uses: actions/cache@v4
3538
with:
36-
path: vendor
37-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
39+
path: ${{ steps.composer-cache.outputs.dir }}
40+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
3841
restore-keys: |
39-
${{ runner.os }}-php-
42+
${{ runner.os }}-composer-
4043
4144
- name: Install Root dependencies
4245
run: composer install --prefer-dist --no-progress

.github/workflows/stylelint.yml renamed to .github/workflows/jobs/stylelint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ jobs:
2020
node-version-file: .nvmrc
2121
cache: "npm"
2222

23-
- name: Cache node modules
23+
- name: Get npm cache directory
24+
id: npm-cache-dir
25+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
26+
27+
- name: Cache npm dependencies
2428
uses: actions/cache@v4
2529
with:
26-
path: ~/.npm
30+
path: ${{ steps.npm-cache-dir.outputs.dir }}
2731
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2832
restore-keys: |
2933
${{ runner.os }}-node-

0 commit comments

Comments
 (0)