Skip to content

chore: Added workflow for Plugin PRs to create zip for testing #21

chore: Added workflow for Plugin PRs to create zip for testing

chore: Added workflow for Plugin PRs to create zip for testing #21

name: Plugin Artifact for PR
on:
pull_request:
paths:
- 'plugins/hwp-previews/**'
- 'plugins/hwp-previews-plugin/**'
jobs:
create-plugin-artifact:
name: Create Plugin Artifact
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Create plugin artifact
working-directory: plugins/hwp-previews
run: |
composer install --no-dev --optimize-autoloader
echo "${GITHUB_SHA}" > build-sha.txt
rm -f plugin-build/hwp-previews.zip
mkdir -p plugin-build
composer archive -vvv --format=zip --file="plugin-build/hwp-previews" --dir="."
- name: Upload plugin artifact
uses: actions/upload-artifact@v4
with:
name: hwp-previews
path: plugins/hwp-previews/plugin-build/*.zip
- name: Comment with artifact link
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
const runId = context.runId;
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${runId}`;
const body = `ℹ️ [Download the plugin artifact from this workflow run](${artifactUrl}) (see the 'Artifacts' section at the bottom).`;
await github.rest.issues.createComment({
issue_number: pr.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
});