Skip to content

Commit

Permalink
Merge pull request #30 from iiroj/cloudflare-pages-actions
Browse files Browse the repository at this point in the history
fix: use Cloudflare Pages Action instead of automatic deployment
  • Loading branch information
iiroj authored Nov 29, 2023
2 parents dc9df36 + 68c9b5a commit 56816ce
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pull Request

on:
pull_request:

jobs:
Preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v3
id: cache-node_modules
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci
- run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- id: deployment
uses: cloudflare/pages-action@v1
with:
accountId: ${{ secrets.CF_ACCOUNT_ID }}
apiToken: ${{ secrets.CF_API_TOKEN }}
directory: public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: iiro
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
tags:
# Semver-like tags "v1.0.0"
- "v[0-9]+.[0-9]+.[0-9]+"

concurrency: production_deployment

jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v3
id: cache-node_modules
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci
- uses: cloudflare/pages-action@v1
with:
accountId: ${{ secrets.CF_ACCOUNT_ID }}
apiToken: ${{ secrets.CF_API_TOKEN }}
branch: main
directory: public
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: iiro

0 comments on commit 56816ce

Please sign in to comment.