Skip to content

Commit

Permalink
feat: shared cloudflare deploy logic
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Jan 18, 2024
1 parent 593d6e2 commit 130d194
Showing 1 changed file with 6 additions and 36 deletions.
42 changes: 6 additions & 36 deletions .github/workflows/cloudflare-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,10 @@ jobs:
contents: read

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

- name: Setup Node
uses: actions/setup-node@v3
- name: Deploy to Cloudflare
uses: ubiquity/cloudflare-deploy-action@main
with:
node-version: "20.10.0"

- name: Yarn Install
run: yarn install

- name: Build the project
run: yarn build
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
- name: Wrangler Install
run: yarn add wrangler

- name: Publish to Cloudflare
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
REPOSITORY: ${{ github.repository }}
PRODUCTION_BRANCH: "development"
OUTPUT_DIRECTORY: "static"
run: |
IFS='/' read -ra fields <<< "$REPOSITORY"
projectName="${fields[1]//./-}"
echo $projectName
yarn wrangler pages project list > project_list.txt
if grep -q $projectName project_list.txt; then
echo "Project found"
else
echo "Project not found"
yarn wrangler pages project create "$projectName" --production-branch "$PRODUCTION_BRANCH"
fi
yarn wrangler pages publish "$OUTPUT_DIRECTORY" --project-name "$projectName"
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
repository: ${{ github.repository }}
production_branch: "development"
output_directory: "static"

0 comments on commit 130d194

Please sign in to comment.