-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #670 from lukso-network/fix/add-cloudflare
fix: Add cloudflare
- Loading branch information
Showing
3 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,43 +2,84 @@ name: ci | |
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
|
||
env: | ||
CF_PROJECT_NAME: tech-docs | ||
CF_BASE_URL: tech-docs-2ac | ||
|
||
jobs: | ||
checks: | ||
if: github.event_name != 'push' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.18.1' | ||
cache: 'yarn' | ||
|
||
- name: Install ⚙️ | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Prettier 🎨 | ||
run: yarn run prettier | ||
|
||
- name: Build 🛠 | ||
run: yarn build | ||
|
||
build-and-deploy: | ||
if: github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
needs: checks | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.18.1' | ||
cache: 'yarn' | ||
|
||
- name: Install ⚙️ | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build 🛠 | ||
run: yarn build | ||
|
||
- name: Deploy 🚀 | ||
uses: JamesIves/[email protected] | ||
- name: Extract branch name | ||
shell: bash | ||
run: | | ||
PR_NUMBER="${{ github.event.number }}" | ||
if [ -n "$PR_NUMBER" ] | ||
then | ||
echo "branch_name=pr-${PR_NUMBER}" >> $GITHUB_OUTPUT | ||
echo "url=https://pr-${PR_NUMBER}.${{ env.CF_BASE_URL }}.pages.dev" >> $GITHUB_OUTPUT | ||
echo "branch=--branch pr-${PR_NUMBER}" >> $GITHUB_OUTPUT | ||
else | ||
echo "branch_name=" >> $GITHUB_OUTPUT | ||
echo "branch=" >> $GITHUB_OUTPUT | ||
fi | ||
id: extract_branch | ||
|
||
- name: Deploy | ||
uses: cloudflare/[email protected] | ||
with: | ||
apiToken: ${{ secrets.CF_API_TOKEN }} | ||
accountId: ${{ secrets.CF_ACCOUNT_ID }} | ||
command: pages deploy --project-name "${CF_PROJECT_NAME}" build ${{ steps.extract_branch.outputs.branch }} | tee output.log | ||
postCommands: | | ||
sed < output.log -n 's#.*Take a peek over at \(.*\)$#specific_url=\1#p' >> $GITHUB_OUTPUT | ||
id: deploy | ||
|
||
- name: Create commit comment | ||
uses: mshick/add-pr-comment@v2 | ||
if: ${{ github.event.number != '' }} | ||
with: | ||
branch: gh-pages # The branch the action should deploy to. | ||
folder: build # The folder the action should deploy. | ||
message: | | ||
### Deployed with **Cloudflare Pages** :cloud: :rocket: :ok: | ||
- **URL**: [${{ steps.extract_branch.outputs.url }}](${{ steps.extract_branch.outputs.url }}) | ||
- **Specific**: [${{ steps.deploy.outputs.specific_url }}](${{ steps.deploy.outputs.specific_url }}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 18.18.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters