Skip to content

Commit

Permalink
ci: add Cloudflare Pages Deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
SidStraw committed Aug 29, 2022
1 parent 77ff639 commit 9b0d257
Show file tree
Hide file tree
Showing 4 changed files with 366 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .github/get-cloudflare-page-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable no-console */
const JSDOM = require('jsdom').JSDOM

const [html] = process.argv.slice(2)
const { document } = new JSDOM(html).window

const linkElement = document.querySelector('a')
console.log(linkElement?.href ? linkElement.href : 'Build failed')
29 changes: 29 additions & 0 deletions .github/workflows/checkrun-completed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Cloudflare Pages Deployed

on:
check_run:
types: [completed]

jobs:
build:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install

- name: Check object
run: |
cat << OBJECT
${{ toJson(github) }}
OBJECT
- name: Get Cloudflare Page URL
run: echo "DEPLOYMENT_URL=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js "${{ github.event.check_run.output.summary }}")"
continue-on-error: true
- run: echo $DEPLOYMENT_URL
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"vuepress": "^1.2.0"
},
"dependencies": {
"jsdom": "^20.0.0",
"vuepress-theme-sidstraw-blog": "file:./.vuepress/theme",
"yaml": "^1.10.0"
}
Expand Down
Loading

0 comments on commit 9b0d257

Please sign in to comment.