Skip to content

Commit 18929f2

Browse files
committed
ci: add Cloudflare Pages Deployed
1 parent 77ff639 commit 18929f2

File tree

4 files changed

+378
-6
lines changed

4 files changed

+378
-6
lines changed

.github/get-cloudflare-page-url.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* eslint-disable no-console */
2+
const JSDOM = require('jsdom').JSDOM
3+
4+
const [html] = process.argv.slice(2)
5+
const { document } = new JSDOM(html).window
6+
7+
console.log(document.querySelector('a').href)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Cloudflare Pages Deployed
2+
3+
on:
4+
check_run:
5+
types: [completed]
6+
7+
jobs:
8+
build:
9+
name: Test
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: '16.x'
17+
cache: 'yarn'
18+
- name: Install dependencies
19+
run: yarn install
20+
21+
- name: Check object
22+
run: |
23+
cat << OBJECT
24+
${{ toJson(github) }}
25+
OBJECT
26+
# - name: Get Cloudflare Page URL
27+
# # id: check-generator
28+
# run: echo "DEPLOYMENT_URL=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js ${{ github.event.check_run.output.summary }})"
29+
# continue-on-error: true
30+
- name: Get Cloudflare Page URL
31+
# id: check-generator
32+
run: echo "DEPLOYMENT_URL=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js "${{ github.event.check_run.output.summary }}")"
33+
continue-on-error: true
34+
# - name: Get Cloudflare Page URL
35+
# # id: check-generator
36+
# run: echo "DEPLOYMENT_URL3=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js ${github.event.check_run.output.summary})"
37+
# continue-on-error: true
38+
# - name: Get Deployment URL
39+
# run: echo "DEPLOYMENT_URL=$(echo "${{ github.event.check_run.output.summary }}" | grep -o "href\=.*>https" | cut -c 7-43)" >> $GITHUB_ENV
40+
- run: echo $DEPLOYMENT_URL
41+
# - run: echo $DEPLOYMENT_URL2
42+
# - run: echo $DEPLOYMENT_URL3

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"vuepress": "^1.2.0"
4040
},
4141
"dependencies": {
42+
"jsdom": "^20.0.0",
4243
"vuepress-theme-sidstraw-blog": "file:./.vuepress/theme",
4344
"yaml": "^1.10.0"
4445
}

0 commit comments

Comments
 (0)