|
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) |
0 commit comments