Skip to content

fix: lsp4 uploads and network selection #391

fix: lsp4 uploads and network selection

fix: lsp4 uploads and network selection #391

Workflow file for this run

name: Build and deploy to Cloudflare Pages
on:
push:
branches: [main]
pull_request:
concurrency: deployment-${{ github.ref }}
env:
CF_PROJECT_NAME: 'universalprofile-test-dapp'
PUBLIC_URL: 'https://up-test-dapp.lukso.tech'
VITE_APP_PUBLIC_API_SHARED_SECRET: ${{ secrets.VITE_APP_PUBLIC_API_SHARED_SECRET }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
if: ${{ github.event.number != '' }}
shell: bash
run: |
if [[ -n "${{ github.event.number }}" ]]
then
BRANCH="${GITHUB_HEAD_REF//[^a-zA-Z0-9]/-}"
BRANCH="${BRANCH//--/-}"
BRANCH="${BRANCH:0:28}"
# Use dummy "zxaxz" to allow regex to match "end of string"
# the normal -$ does not seem to work due to the github.com
# yaml parser expeding a variable name after.
# The string zxaxz is very unlikely to be part of a branch name.
if [[ "${BRANCH}zxaxz" =~ -zxaxz ]]
then
BRANCH="${BRANCH::-1}"
fi
echo "branch=--branch=${BRANCH}" >> $GITHUB_OUTPUT
echo "url=https://${BRANCH}.${{ env.CF_PROJECT_NAME }}.pages.dev" >> $GITHUB_OUTPUT
else
echo "url=${PUBLIC_URL}" >> $GITHUB_OUTPUT
fi
id: extract_branch
- name: πŸ›ŽοΈ Checkout
uses: actions/checkout@v4
- name: πŸŽ› Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
- name: βš™οΈ Install
run: yarn
- name: 🎨 Lint JS
run: yarn lint:js
- name: 🎨 Lint CSS
run: yarn lint:css
- name: 🎨 Lint Format
run: yarn lint:format
- name: 🎨 Lint Types
run: yarn lint:types
- name: πŸ›  Build
run: yarn build
- name: 🎯 Test
run: yarn test
- 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}" dist ${{ 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:
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 }})