Skip to content

Commit a966062

Browse files
authored
Merge pull request #1 from lukso-network/fix/add-deployment
fix: Add deployment
2 parents 2431a54 + 2f2bf8f commit a966062

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

.github/workflows/ci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Lint, Test, Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'main'
7+
push:
8+
branches:
9+
- 'main'
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
environment: main
15+
steps:
16+
- name: Extract branch name
17+
shell: bash
18+
run: |
19+
PR_NUMBER="${{ github.event.number }}"
20+
if [ -n "$PR_NUMBER" ]
21+
then
22+
echo "branch_name=pr-${PR_NUMBER}" >> $GITHUB_OUTPUT
23+
echo "url=https://pr-${PR_NUMBER}.${{ secrets.CF_BASE_URL }}.pages.dev" >> $GITHUB_OUTPUT
24+
else
25+
if [ "${{ github.ref }}" = "refs/heads/develop" ]
26+
then
27+
echo "branch_name=develop" >> $GITHUB_OUTPUT
28+
echo "url=https://develop.${{ secrets.CF_BASE_URL }}.pages.dev" >> $GITHUB_OUTPUT
29+
else
30+
echo "branch_name=" >> $GITHUB_OUTPUT
31+
fi
32+
fi
33+
id: extract_branch
34+
35+
- uses: actions/checkout@v4 # Updated to the latest version
36+
37+
- uses: actions/setup-node@v3 # Latest version as of now
38+
with:
39+
node-version: '22.12.0'
40+
cache: 'npm'
41+
42+
- name: ⚙️ Install dependencies
43+
run: npm install
44+
45+
- name: Build
46+
run: |
47+
npx @cloudflare/next-on-pages
48+
49+
- name: 'Deploy release'
50+
if: ${{ steps.extract_branch.outputs.branch_name == '' }}
51+
env:
52+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
53+
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
54+
run: |
55+
npx wrangler pages deploy --project-name "${{ secrets.CF_PROJECT_NAME }}" .vercel/output/static
56+
57+
- name: Deploy ${{ steps.extract_branch.outputs.branch_name }} (PR)
58+
if: ${{ steps.extract_branch.outputs.branch_name != '' }}
59+
env:
60+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
61+
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
62+
run: |
63+
npx wrangler pages deploy --project-name "${{ secrets.CF_PROJECT_NAME }}" --branch "${{ steps.extract_branch.outputs.branch_name }}" .vercel/output/static | tee output.log
64+
sed < output.log -n 's#.*Take a peek over at \(.*\)$#specific_url=\1#p' >> $GITHUB_OUTPUT
65+
id: deploy
66+
67+
- name: Create commit comment
68+
uses: mshick/[email protected] # Updated to latest version
69+
if: ${{ steps.extract_branch.outputs.branch_name != '' }}
70+
with:
71+
message: |
72+
### Deployed with **Cloudflare Pages** :cloud: :rocket: :ok:
73+
- **URL**: [${{ steps.extract_branch.outputs.url }}](${{ steps.extract_branch.outputs.url }})

.mise.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tools]
2+
node = "22"

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v22.12.0

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 22.12.0

0 commit comments

Comments
 (0)