Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from rndquu/ci/deploy-v2
Browse files Browse the repository at this point in the history
ci: use latest cloudflare deploy
  • Loading branch information
rndquu authored Mar 19, 2024
2 parents 39bbbbd + 889bb1e commit 8cf673c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 49 deletions.
36 changes: 10 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,33 @@ name: Build

on:
push:
branches:
- development
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-22.04
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "20.8.0"
node-version: "20.10.0"

- name: Yarn Install
run: yarn install

- name: Build
run: yarn build:prod

- name: Add commit SHA file to build folder
run: echo -n $(echo "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" | cut -c1-7) > build/commit.txt

- name: Prepare Deployment Artifact
env:
EVENT_NAME: ${{github.event_name}}
PR_NUMBER: ${{ github.event.number }}
SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
run: |
echo "event_name=$EVENT_NAME,pr_number=$PR_NUMBER,sha=$SHA"
mkdir -p ./pr
echo "event_name=$EVENT_NAME,pr_number=$PR_NUMBER,sha=$SHA," > ./pr/pr_number
cd ./build && zip -r ../pr/pull-request.zip ./*
- uses: actions/upload-artifact@v3
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: pr
path: pr/
name: build
path: build
23 changes: 0 additions & 23 deletions .github/workflows/continuous-deploy.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy to Cloudflare Pages

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
deploy-to-cloudflare:
name: Automatic Cloudflare Deploy
runs-on: ubuntu-22.04
steps:
- name: Deploy to Cloudflare
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ubiquity/cloudflare-deploy-action@main
with:
repository: ${{ github.repository }}
production_branch: ${{ github.event.repository.default_branch }}
output_directory: "build"
current_branch: ${{ github.event.workflow_run.head_branch }}
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
commit_sha: ${{ github.event.workflow_run.head_sha }}
workflow_run_id: ${{ github.event.workflow_run.id }}

0 comments on commit 8cf673c

Please sign in to comment.