feat(poc): Rebuild the PoC Dapp with React #339
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
name: ci | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
unified: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: corepack enable | |
- name: Install deps | |
run: yarn --immutable | |
- name: Build | |
run: yarn build | |
env: | |
VITE_PRICE_API_KEY: ${{ secrets.VITE_PRICE_API_KEY }} | |
- name: Lint | |
run: yarn run lint | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
- name: "Unit Tests" | |
run: "yarn run test:unit" | |
- name: "Integrations Tests" | |
run: "yarn run test:integrations" | |
- name: Set branch name for Cloudflare Pages | |
id: cf-branch | |
run: | | |
if [[ "${{ github.ref_name }}" == "master" ]]; then | |
echo "CF_BRANCH_NAME=preview" >> $GITHUB_ENV | |
else | |
echo "CF_BRANCH_NAME=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV | |
fi | |
- name: Publish Docs to Cloudflare Pages | |
id: docs-publish | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: 2238a825c5aca59233eab1f221f7aefb | |
command: pages deploy ./docs/build --project-name=sprinter-docs --branch=${{ env.CF_BRANCH_NAME }} | |
- name: Publish POC to Cloudflare Pages | |
id: poc-publish | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: 2238a825c5aca59233eab1f221f7aefb | |
command: pages deploy ./web/dist --project-name=sprinter-poc --branch=${{ env.CF_BRANCH_NAME }} | |
- name: Generate Deployment Summary | |
run: | | |
echo "# 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "| **Project** | **Preview URL** |" >> $GITHUB_STEP_SUMMARY | |
echo "| ----------------------- | ---------------- |" >> $GITHUB_STEP_SUMMARY | |
echo "| **Docs** | [View Docs -> ${{ steps.docs-publish.outputs.deployment-url }}](${{ steps.docs-publish.outputs.deployment-url }}) |" >> $GITHUB_STEP_SUMMARY | |
echo "| **POC** | [View POC -> ${{ steps.poc-publish.outputs.deployment-url }}](${{ steps.poc-publish.outputs.deployment-url }}) |" >> $GITHUB_STEP_SUMMARY | |
- name: Notify About Deployment | |
if: ${{ github.actor != 'dependabot[bot]' && github.ref_name != 'master' }} | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const docsUrl = `**Docs:** [View Deployment -> ${{ steps.docs-publish.outputs.deployment-url }}](${{ steps.docs-publish.outputs.deployment-url }})`; | |
const pocUrl = `**POC:** [View Deployment -> ${{ steps.poc-publish.outputs.deployment-url }}](${{ steps.poc-publish.outputs.deployment-url }})`; | |
const message = `🚀 **Deployment Completed**\n\n${docsUrl}\n${pocUrl}`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: message, | |
}); | |
# old deployment | |
- name: Publish Docs to Cloudflare Pages (old project) | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: 2238a825c5aca59233eab1f221f7aefb | |
command: pages deploy ./docs/build --project-name=gopher-docs --branch=${{ env.CF_BRANCH_NAME }} | |
- name: Publish POC to Cloudflare Pages (old project) | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: 2238a825c5aca59233eab1f221f7aefb | |
command: pages deploy ./web/dist --project-name=gopher-poc --branch=${{ env.CF_BRANCH_NAME }} |