Skip to content

Commit

Permalink
ci: fix staging workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-hosseini-deriv committed Jun 7, 2024
1 parent d1e5a55 commit 012e4f0
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,23 @@ jobs:
run: npm ci
shell: bash

- name: Build staging
- name: Build
run: npm run build
env:
VITE_PROJECT_NAME: ${{ vars.VITE_PROJECT_NAME }}
VITE_CROWDIN_BRANCH_NAME: ${{ vars.VITE_CROWDIN_BRANCH_NAME }}
VITE_TRANSLATIONS_CDN_URL: ${{ vars.VITE_TRANSLATIONS_CDN_URL }}


- name: Run tests for Eslint
- name: Run tests for Eslintbuild_to_cloudflare_pages
run: npm run test:lint

- name: Publish to Cloudflare Pages
id: publish-to-pages
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
HEAD_BRANCH: ${{ github.head_ref }}
run: |
echo "Installing Wrangler CLI"
npm i -g wrangler
echo "Deploying build to Cloudflare Pages"
directory='dist'
projectName=${{ secrets.CLOUDFLARE_PROJECT_NAME }}
branch=$(echo "$HEAD_BRANCH" | head -c 20 | sed 's/[\/_\.]/-/g; s/[^a-zA-Z0-9]$/1/')
cf_preview_url=$(wrangler pages deploy $directory --project-name=$projectName --branch=$branch > log.txt 2>&1; echo $?)
echo "------"
preview_url=https://$branch.$projectName.pages.dev
cat log.txt
uses: "deriv-com/shared-actions/.github/actions/publish_to_pages_branch@master"
with:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
project_name: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
branch_name: staging
output_dir: dist
cname_url: staging-p2p.deriv.com

0 comments on commit 012e4f0

Please sign in to comment.