-
Notifications
You must be signed in to change notification settings - Fork 145
64 lines (54 loc) · 1.7 KB
/
deploy-create-artifact.yml
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
name: 'Deploy / Create Artifact'
on:
workflow_call:
inputs:
checkout-ref:
required: false
type: string
retention-days:
required: false
type: number
default: 1
env:
ARTIFACT_NAME: 'coblocks-plugin'
ARTIFACT_PATH: 'coblocks'
ARTIFACT_ZIP: 'coblocks.zip'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout-ref != '' && inputs.checkout-ref || github.event.repository.default_branch }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@main
# Yarn is still required on this project, so we need to make sure it is
# installed globally.
- name: Install yarn
run: |
npm i -g yarn
- name: Install dependencies
run: |
composer install --prefer-dist --optimize-autoloader
yarn install --immutable
- name: Build plugin
run: |
npx grunt build
- name: Create distribution artifact
run: |
rsync --archive --recursive --filter='protect .git' --delete --prune-empty-dirs --include-from="$GITHUB_WORKSPACE/.distinclude" "$GITHUB_WORKSPACE/" "$GITHUB_WORKSPACE/$ARTIFACT_PATH/"
zip -r $ARTIFACT_ZIP $ARTIFACT_PATH
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_ZIP }}
if-no-files-found: error
retention-days: ${{ inputs.retention-days }}