Skip to content

Commit

Permalink
🎉: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arddluma committed May 7, 2022
0 parents commit 9fce52b
Show file tree
Hide file tree
Showing 13 changed files with 12,414 additions and 0 deletions.
Binary file added .github/images/build-failed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/images/deployment-succeeded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Keep the versions up-to-date

on:
release:
types: [published, edited]

jobs:
actions-tagger:
runs-on: windows-latest
steps:
- uses: Actions-R-Us/actions-tagger@latest
with:
publish_latest_tag: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#/dist/
/node_modules/
tsconfig.tsbuildinfo
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 Daniel Walsh (WalshyDev)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# CloudFlare Pages Slack notification
## Using [CF Pages Await](https://github.com/WalshyDev/cf-pages-await) made by Daniel Walsh [WalshyDev](https://github.com/WalshyDev)

Wait for Cloudflare Pages build to finish and send Slack notification

## Usage
```yml
- name: Await CF Pages and send Slack notification
uses: arddluma/cf-pages-slack-notification@v2
with:
accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL }}
apiKey: ${{ secrets.CF_API_KEY }}
accountId: ${{ secrets.CF_ACC_ID }}
# CloudFlare Pages project name
project: ${{ secrets.CF_PAGES_PROJECT }}
# Add this if you want GitHub Deployments (see below)
githubToken: ${{ secrets.GITHUB_TOKEN }}
# Create Slack Incoming webhook and add as variable https://hooks.slack.com/...
slackWebHook: ${{ secrets.SLACK_WEBHOOK }}
# Add this if you want to wait for a deployment triggered by a specfied commit
commitHash: ${{ steps.push-changes.outputs.commit-hash }}
```
### Example
```yml
name: Deploy
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Await CF Pages and send Slack notification
id: cf-pages
uses: arddluma/cf-pages-slack-notification@v2
with:
accountEmail: ${{ secrets.CF_ACCOUNT_EMAIL }}
apiKey: ${{ secrets.CF_API_KEY }}
accountId: ${{ secrets.CF_ACC_ID }}
# CloudFlare Pages project name
project: ${{ secrets.CF_PAGES_PROJECT }}
# Create Slack Incoming webhook and add as variable https://hooks.slack.com/...
slackWebHook: ${{ secrets.SLACK_WEBHOOK }}
# Add this if you want GitHub Deployments (see below)
githubToken: ${{ secrets.GITHUB_TOKEN }}
```
## Screenshots
### If build phase fails:
![Build Fails](.github/images/build-failed.png)
### If deployment phase is successful:
![Deployment Successful](.github/images/deployment-succeeded.png)
## Outputs
* `id` - Deployment ID, example: `50ff553c-da5d-4846-8188-25ae82a3bb7d`
* `environment` - Envrionment for this deployment, either `production` or `preview`
* `url` - URL for this deployment
* `alias` - Alias URL (Will be the branch URL such as `fix-issue.project.pages.dev` or be the deployment URL)
* `success` - If the deployment was successful

## GitHub Deployments
GitHub Deployments will show if the deployment was successful or failed right inside GitHub! You can easily see the status, view the website (exact deployment) and see the logs.

> **Note**: You need to add the `githubToken` input in order for deployments to work!

### Overview
![Successful production deployment](https://user-images.githubusercontent.com/8492901/149387681-25ec860d-0c8e-4075-8ab0-4d289b86127b.png)

### Pull Requests
**In Progress**
![In progress deployment in PR](https://user-images.githubusercontent.com/8492901/149388796-6bbd4ae9-b7b3-4d06-80c5-c18b3737f51f.png)

**Successful**
![Successful deployment in PR](https://user-images.githubusercontent.com/8492901/149388892-14a7ea25-6865-4d52-b403-30e8cec449d2.png)
42 changes: 42 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Cloudflare Pages Slack Notification'
description: 'Wait for Cloudflare Pages to build and send Slack notification'
author: 'arddluma'
inputs:
accountEmail:
description: 'Cloudflare account email (Needed for auth)'
required: true
apiKey:
description: 'Cloudflare API Key (Tokens aren''t supported in the API yet :( )'
required: true
accountId:
description: 'Cloudflare account ID'
required: true
project:
description: 'Pages project name'
required: true
githubToken:
description: 'GitHub Token to use for deployments (GITHUB_TOKEN secret or your own token!) - OPTIONAL (Only used for GitHub Deployments)'
required: false
commitHash:
description: 'The commit hash of the commit triggered the target deployment'
required: true
slackWebHook:
description: 'Slack incoming webhook url'
required: true
outputs:
id:
description: 'Deployment ID'
environment:
description: 'Environment for this deployment, either "production" or "preview"'
url:
description: 'URL of the deployment'
alias:
description: 'Alias URL of the branch (for example: fix-navbar.project.pages.dev)'
success:
description: 'If the build passed or failed'
runs:
using: 'node12'
main: 'dist/action.js'
branding:
icon: 'cloud'
color: 'orange'
Loading

0 comments on commit 9fce52b

Please sign in to comment.