Support session stickiness #139
Workflow file for this run
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: Pull request Analysis and preview ( Mainnet ) | |
# Notes: | |
# This pipeline will deploy the page on Cloudflare Pages ( direct upload ), Similar to a S3 bucket. | |
# You need to have the following secrets and variables defined in your repository: | |
# - PRODUCTION_ENV_NAME | |
# - PRODUCTION_ENV_URL | |
# - DEVELOPMENT_ENV_NAME | |
# - DEVELOPMENT_ENV_URL | |
# - CLOUDFLARE_API_TOKEN -> https://developers.cloudflare.com/workers/wrangler/ci-cd/#api-token | |
# - CLOUDFLARE_ACCOUNT_ID -> Request to devops team to get this value | |
on: | |
pull_request: | |
branches: [ "main" ] | |
types: [opened, synchronize, edited, ready_for_review] | |
permissions: | |
pull-requests: write | |
actions: write | |
contents: read | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/Checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' # You can choose npm|yarn|pnpm | |
- name: Install dependencies | |
run: yarn install # If you use npm, you would run: npm ci | |
- name: Build | |
run: yarn build | |
env: | |
NODE_ENV: development | |
# If we need, we can easily change thjis step to deploy to S3 bucket | |
- name: Deploy | |
id: deploy | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
packageManager: yarn | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy ./dist --project-name ${{ vars.PRODUCTION_ENV_NAME }} --branch ${{ env.GITHUB_REF_NAME }} --commit-hash ${{ env.GITHUB_SHA }} | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'You can preview the changes at : ${{ steps.deploy.outputs.deployment-url }}' | |
}) |