Merge pull request #1298 from lukso-network/docs/indexer-api #4458
This file contains hidden or 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
| name: ci | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| env: | |
| CF_PROJECT_NAME: tech-docs | |
| CF_BASE_URL: tech-docs-2ac | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout 🛎️ | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'yarn' | |
| - name: Install ⚙️ | |
| run: yarn install --frozen-lockfile | |
| - name: Prettier 🎨 | |
| run: yarn run prettier | |
| - name: Build 🧱 | |
| run: yarn run build | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| needs: checks | |
| steps: | |
| - name: Checkout 🛎️ | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'yarn' | |
| - name: Install ⚙️ | |
| run: yarn install --frozen-lockfile | |
| - name: Build 🛠 | |
| run: yarn build | |
| - 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=--branch main" >> $GITHUB_OUTPUT | |
| fi | |
| id: extract_branch | |
| - name: 🚀 Deploy | |
| env: | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | |
| run: | | |
| yarn dlx [email protected] pages deploy --commit-dirty=true --project-name "${CF_PROJECT_NAME}" build ${{ steps.extract_branch.outputs.branch }} | tee output.log | |
| 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 }}) |