Skip to content

Commit cd84bae

Browse files
authored
Merge pull request #2 from univdev/develop
PR for v1.0.0 version release (#1)
2 parents 520eb7b + bff7780 commit cd84bae

File tree

11 files changed

+879
-3
lines changed

11 files changed

+879
-3
lines changed

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

README.md

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,75 @@
1-
# Github Action for Vercel deploy
1+
# Vercel deploy with slack
2+
3+
**GitHub Action for Vercel Distribution and Slack Message Transfer**
4+
5+
This action helps automate deployments to Vercel while sending real-time status updates to a Slack channel via custom message payloads.
6+
7+
## Inputs
8+
9+
| Name | Description | Required |
10+
|------------------------------------ |----------------------------------------------------------------------------|----------|
11+
| `vercel-token-id` | Vercel API token for authenticating deployment requests. | `true` |
12+
| `slack-webhook-url` | Slack Incoming Webhook URL for sending deployment status updates. | `true` |
13+
| `slack-deploy-start-message-payload`| Custom payload for the message to be sent when the deployment starts. | `true` |
14+
| `slack-deploy-failed-message-payload`| Custom payload for the message to be sent if the deployment fails. | `true` |
15+
| `slack-deploy-succeed-message-payload`| Custom payload for the message to be sent when the deployment succeeds. | `true` |
16+
17+
## Outputs
18+
19+
| Name | Description |
20+
|------------------|-------------------------------------------------|
21+
| `process-time` | The total time taken to complete the deployment.|
22+
23+
## Example Usage
24+
25+
```yaml
26+
name: Deploy to Vercel with Slack Notifications
27+
28+
on: [push]
29+
30+
jobs:
31+
deploy:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v3
36+
37+
- name: Deploy with Slack notifications
38+
uses: univdev/vercel-deploy-with-slack@v1
39+
with:
40+
vercel-token-id: ${{ secrets.VERCEL_TOKEN }}
41+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
42+
slack-deploy-start-message-payload: '{"text": "Deployment has started..."}'
43+
slack-deploy-failed-message-payload: '{"text": "Deployment failed!"}'
44+
slack-deploy-succeed-message-payload: '{"text": "Deployment succeeded!"}'
45+
```
46+
47+
## Inputs Explanation
48+
49+
- vercel-token-id: This is your Vercel API token, required to authenticate the deployment request. Make sure to store this token as a GitHub secret.
50+
- slack-webhook-url: Your Slack Incoming Webhook URL where deployment status updates will be sent. Also recommended to store as a GitHub secret.
51+
- slack-deploy-start-message-payload: A custom JSON payload defining the message that will be sent when the deployment starts. Typically includes a text field, but you can customize it according to your Slack API payload format.
52+
- slack-deploy-failed-message-payload: A custom JSON payload that is sent if the deployment fails.
53+
- slack-deploy-success-message-payload: A custom JSON payload that is sent when the deployment succeeds.
54+
55+
## Outputs
56+
- process-time: The action outputs the total time taken to complete the deployment process, which can be used for further logging or metrics.
57+
Customizing Slack Messages
58+
59+
To customize the Slack messages, use Slack's message formatting capabilities. Here's an example of a basic message payload:
60+
61+
```json
62+
{
63+
"text": "Deployment started for project XYZ.",
64+
"attachments": [
65+
{
66+
"text": "We're deploying the latest changes.",
67+
"color": "#36a64f"
68+
}
69+
]
70+
}
71+
```
72+
73+
You can pass similar JSON payloads as values to the Slack-related inputs.
74+
75+
Slack message format guide: [Here!](https://api.slack.com/messaging/webhooks)

action.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: vercel-deploy-with-slack
2+
description: Github Action for Vercel Distribution and Slack Message Transfer
3+
inputs:
4+
vercel-token-id:
5+
description: 'Vercel API token for authenticating deployment requests.'
6+
required: true
7+
slack-webhook-url:
8+
description: 'Slack Incoming Webhook URL for sending deployment status updates.'
9+
required: true
10+
slack-deploy-start-message-payload:
11+
description: 'Custom payload for the message to be sent when the deployment starts.'
12+
required: true
13+
slack-deploy-failed-message-payload:
14+
description: 'Custom payload for the message to be sent if the deployment fails.'
15+
required: true
16+
slack-deploy-succeed-message-payload:
17+
description: 'Custom payload for the message to be sent when the deployment succeeds.'
18+
required: true
19+
outputs:
20+
process-time:
21+
description: 'The total time taken to complete the deployment process.'
22+
runs:
23+
using: 'node20'
24+
main: 'dist/main'

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
{
22
"name": "vercel-deploy-with-slack",
3+
"type": "module",
34
"version": "1.0.0",
45
"description": "Github Action for Vercel Distribution and Slack Message Transfer",
5-
"main": "index.js",
6+
"main": "dist/index.js",
67
"author": "univdev <[email protected]>",
7-
"license": "ISC"
8+
"license": "ISC",
9+
"scripts": {
10+
"build": "tsc && vite build"
11+
},
12+
"devDependencies": {
13+
"typescript": "^5.5.3",
14+
"vite": "^5.4.8"
15+
},
16+
"dependencies": {
17+
"@actions/core": "^1.11.1",
18+
"@types/node": "^22.7.5"
19+
}
820
}

0 commit comments

Comments
 (0)