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 18929f2
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/get-cloudflare-page-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-disable no-console */
const JSDOM = require('jsdom').JSDOM

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

console.log(document.querySelector('a').href)
42 changes: 42 additions & 0 deletions .github/workflows/checkrun-completed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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
# # id: check-generator
# run: echo "DEPLOYMENT_URL=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js ${{ github.event.check_run.output.summary }})"
# continue-on-error: true
- name: Get Cloudflare Page URL
# id: check-generator
run: echo "DEPLOYMENT_URL=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js "${{ github.event.check_run.output.summary }}")"
continue-on-error: true
# - name: Get Cloudflare Page URL
# # id: check-generator
# run: echo "DEPLOYMENT_URL3=$(node ${GITHUB_WORKSPACE}/.github/get-cloudflare-page-url.js ${github.event.check_run.output.summary})"
# continue-on-error: true
# - name: Get Deployment URL
# run: echo "DEPLOYMENT_URL=$(echo "${{ github.event.check_run.output.summary }}" | grep -o "href\=.*>https" | cut -c 7-43)" >> $GITHUB_ENV
- run: echo $DEPLOYMENT_URL
# - run: echo $DEPLOYMENT_URL2
# - run: echo $DEPLOYMENT_URL3
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 18929f2

Please sign in to comment.