mirror of
https://github.com/kou029w/jwk.pages.dev.git
synced 2025-01-30 13:58:00 +00:00
add deploy workflow [skip ci]
This commit is contained in:
parent
e808fda003
commit
89e1b3f942
2 changed files with 33 additions and 3 deletions
21
.github/workflows/deploy.yml
vendored
Normal file
21
.github/workflows/deploy.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
name: deploy
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# 3月16日土曜日 20:00 (JST) は 3月16日土曜日 11:00 (UTC)
|
||||
# https://time.is/compare/JST/UTC
|
||||
# https://crontab.guru/#00_11_16_03_SAT
|
||||
- cron: 00 11 16 3 SAT
|
||||
push:
|
||||
branches: main
|
||||
jobs:
|
||||
deploy:
|
||||
if: github.ref == 'refs/heads/main'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 1
|
||||
steps:
|
||||
- name: Deploy
|
||||
run: curl -sSf -X POST "${DEPLOY_WEBHOOK_URL}"
|
||||
env:
|
||||
# https://developers.cloudflare.com/pages/platform/deploy-hooks
|
||||
DEPLOY_WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }}
|
15
.github/workflows/test.yml
vendored
15
.github/workflows/test.yml
vendored
|
@ -1,5 +1,9 @@
|
|||
name: test
|
||||
on: pull_request
|
||||
on:
|
||||
pull_request:
|
||||
workflow_run:
|
||||
workflows: deploy
|
||||
types: completed
|
||||
jobs:
|
||||
test:
|
||||
strategy:
|
||||
|
@ -19,11 +23,16 @@ jobs:
|
|||
run: npm ci
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
- name: Run tests
|
||||
- if: github.ref_name != github.event.repository.default_branch
|
||||
id: set_preview_env
|
||||
shell: bash
|
||||
run: BASE_URL="https://$(echo "${HEAD_REF}" | sed s/[^_0-9a-z]/-/gi).jwk.pages.dev/" npm test
|
||||
run: echo url="https://$(echo "${HEAD_REF}" | sed s/[^_0-9a-z]/-/gi).jwk.pages.dev/" >> "${GITHUB_OUTPUT}"
|
||||
env:
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
- name: Run tests in ${{ env.BASE_URL }}
|
||||
run: npm test
|
||||
env:
|
||||
BASE_URL: ${{ github.ref_name == github.event.repository.default_branch && 'https://jwk.pages.dev/' || steps.set_preview_env.outputs.url }}
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
|
|
Loading…
Add table
Reference in a new issue