Skip to content

Commit 3ee21b6

Browse files
committed
Trying to extract functionality into its own action so webhooks and other plugins can re-use
1 parent 89ee43d commit 3ee21b6

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: 'Create Plugin Artifact'
2+
description: 'Builds and uploads a plugin artifact for a PR if a plugin directory is modified.'
3+
inputs:
4+
slug:
5+
description: 'Plugin slug (directory name under plugins/)'
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Set up PHP
11+
uses: shivammathur/setup-php@v2
12+
with:
13+
php-version: '7.4'
14+
15+
- name: Install dependencies and build
16+
working-directory: plugins/${{ inputs.slug }}
17+
run: |
18+
composer install --no-dev --optimize-autoloader
19+
echo "${GITHUB_SHA}" > build-sha.txt
20+
rm -f plugin-build/${{ inputs.slug }}-*.zip
21+
composer archive -vvv --format=zip --file="plugin-build/${{ inputs.slug }}" --dir="."
22+
shell: bash
23+
24+
- name: Upload plugin artifact
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: ${{ inputs.slug }}-${{ github.sha }}
28+
path: plugins/${{ inputs.slug }}/plugin-build/*.zip

.github/workflows/plugin-artifact-for-pr.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,10 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717

18-
- name: Set up PHP
19-
uses: shivammathur/setup-php@v2
20-
with:
21-
php-version: '7.4'
22-
2318
- name: Create plugin artifact
24-
working-directory: plugins/hwp-previews
25-
run: |
26-
composer install --no-dev --optimize-autoloader
27-
echo "${GITHUB_SHA}" > build-sha.txt
28-
rm -f plugin-build/hwp-previews-*.zip
29-
composer archive -vvv --format=zip --file="plugin-build/hwp-previews" --dir="."
30-
31-
- name: Upload plugin artifact
32-
uses: actions/upload-artifact@v4
19+
uses: ./.github/actions/create-plugin-artifact
3320
with:
34-
name: hwp-previews-${{ github.sha }}
35-
path: plugins/hwp-previews/plugin-build/*.zip
21+
slug: hwp-previews
3622

3723
- name: Comment with artifact link
3824
uses: actions/github-script@v7

0 commit comments

Comments
 (0)