@orange-soft/strapi-deployment-trigger
v1.2.0
Published
Strapi v5 plugin to trigger GitHub Actions workflow deployments from the admin panel
Readme
Strapi Plugin: Deployment Trigger
A Strapi v5 plugin that allows you to trigger deployments directly from the Strapi admin panel. Supports both GitHub Actions and Vercel deployments.
Features
- Trigger GitHub Actions
workflow_dispatchevents from the admin UI - Trigger Vercel deployments via deploy hooks
- Configure multiple deployment targets (e.g., Production, Staging)
- Support for different trigger types per target
- Secure token storage in database
- Token masking for security
- Direct link to GitHub Actions to monitor deployment progress
Requirements
- Strapi v5.x
- Node.js >= 18.x
- A GitHub repository with a workflow that supports
workflow_dispatch
Installation
npm install @orange-soft/strapi-deployment-trigger
# or
yarn add @orange-soft/strapi-deployment-triggerConfiguration
1. Enable the plugin
Add the plugin to your config/plugins.ts (or config/plugins.js):
export default () => ({
'deployment-trigger': {
enabled: true,
},
});2. Configure via Admin UI
- Go to Plugins > Deployment Trigger > Settings in your Strapi admin
- For GitHub targets:
- Enter your GitHub repository URL (e.g.,
https://github.com/owner/repo) - Enter your GitHub Personal Access Token
- Add a target with type "GitHub", workflow filename, and branch
- Enter your GitHub repository URL (e.g.,
- For Vercel targets:
- Add a target with type "Vercel" and paste your deploy hook URL
All settings including tokens are stored securely in the Strapi database.
GitHub Token Setup
You need a GitHub Fine-grained Personal Access Token with the following permissions:
- Go to GitHub > Settings > Developer settings > Personal access tokens > Fine-grained tokens
- Click "Generate new token"
- Set token name and expiration
- Select the target repository under "Repository access"
- Under "Repository permissions", set Actions to "Read and write"
- Click "Generate token"
GitHub Workflow Setup
Your workflow file (e.g., .github/workflows/deploy.yml) must include the workflow_dispatch trigger:
name: Deploy
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# ... your deployment stepsVercel Deploy Hook Setup
To trigger Vercel deployments, you need to create a Deploy Hook:
- Go to your Vercel project dashboard
- Navigate to Settings > Git
- Scroll down to Deploy Hooks
- Click Create Hook
- Enter a name (e.g., "Strapi Trigger") and select the branch
- Click Create Hook
- Copy the generated webhook URL (starts with
https://api.vercel.com/v1/integrations/deploy/...) - Paste this URL when adding a Vercel target in the plugin settings
Usage
- Navigate to Plugins > Deployment Trigger > Settings in your Strapi admin
- For GitHub targets: Configure repository URL and GitHub token
- Add deployment targets:
- GitHub: Select type "GitHub", enter name, workflow file, and branch
- Vercel: Select type "Vercel", enter name and webhook URL
- Go to the main Deployment Trigger page
- Click Trigger on any configured target
- For GitHub targets, click the provided link to monitor progress in GitHub Actions
API
The plugin exposes the following admin API endpoints:
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /deployment-trigger/settings | Get current settings |
| PUT | /deployment-trigger/settings | Update settings |
| GET | /deployment-trigger/status | Get configuration status |
| POST | /deployment-trigger/trigger | Trigger deployment |
License
MIT
Author
Justin Moh [email protected]
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
