-
-
Notifications
You must be signed in to change notification settings - Fork 31
78 lines (64 loc) · 2.63 KB
/
upload-schema-artifact.yml
File metadata and controls
78 lines (64 loc) · 2.63 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: Upload Schema Artifact
on:
release:
types: [published]
jobs:
run:
name: Generate and Upload WPGraphQL Schema Artifact
runs-on: ubuntu-24.04
permissions:
contents: read
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
persist-credentials: false
- name: Set up PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
with:
php-version: 8.4
coverage: none
# This date is used to ensure that the PHPCS cache is cleared at least once every week.
# http://man7.org/linux/man-pages/man1/date.1.html
- name: "Get last Monday's date"
id: get-date
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> "$GITHUB_OUTPUT"
- name: Install Composer dependencies
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3.1.1
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> "$GITHUB_PATH"
- name: Setup Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: Install NPM dependencies
run: npm ci
- name: Cache Docker images
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ~/.wp-env
key: ${{ runner.os }}-wp-env-${{ hashFiles('.wp-env.json', 'package.json') }}
restore-keys: |
${{ runner.os }}-wp-env-
- name: Setup .env file
run: |
cp .env.dist .env
echo GF_KEY=${{ secrets.GF_KEY }} >> .env
- name: Start the Docker testing environment
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
with:
timeout_minutes: 10
max_attempts: 3
command: |
npm run wp-env start -- --update ${{ secrets.ACTIONS_STEP_DEBUG && '--debug' || '' }}
- name: Generate GraphQL schema
run: |
npm run wp-env -- run cli --env-cwd=wp-content/plugins/wp-graphql-gravity-forms wp graphql generate-static-schema --output=tests/_output/schema.graphql
echo "Schema generated: $(wc -l < tests/_output/schema.graphql) lines"
- name: Upload schema as release artifact
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
files: tests/_output/schema.graphql