Skip to content

Update dependency @types/node to ^18.19.33 #1353

Update dependency @types/node to ^18.19.33

Update dependency @types/node to ^18.19.33 #1353

Workflow file for this run

name: Staging
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
actions: read
pull-requests: write
checks: write
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
outputs:
publish_cf_pages: ${{ steps.check_cf_pages.outputs.publish_cf_pages }}
steps:
- name: Checkout git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
- name: Setup Node with caching
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "pnpm"
- name: NX cache
uses: actions/cache@v3
with:
path: node_modules/.cache/nx
key: nx-${{ github.ref }}
- name: Derive HEAD and BASE shas for 'nx affected'
uses: nrwl/nx-set-shas@v4
- name: Install dependencies
run: pnpm install --frozen-lockfile --strict-peer-dependencies
- name: Test
run: pnpm nx affected --parallel --targets=lint,test:cov
- name: Check if can publish code coverage
id: check_codecov
run: |
if [ "$CODECOV_TOKEN" == "" ]; then
echo "publish_codecov=0" >> $GITHUB_OUTPUT
else
echo "publish_codecov=1" >> $GITHUB_OUTPUT
fi
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Publish code coverage
if: steps.check_codecov.outputs.publish_codecov == '1'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Check if can publish to cloudflare
id: check_cf_pages
run: |
if [ "$CLOUDFLARE_API_TOKEN" == "" ] \
|| [ "$CLOUDFLARE_ACCOUNT_ID" == "" ] \
|| [ "$CLOUDFLARE_PAGES_PROJECT" == "" ]; then
echo "publish_cf_pages=0" >> $GITHUB_OUTPUT
else
echo "publish_cf_pages=1" >> $GITHUB_OUTPUT
fi
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT }}
publish:
name: Publish to CF pages
if: needs.test.outputs.publish_cf_pages == '1'
runs-on: ubuntu-latest
needs:
- test
environment:
name: Staging
url: ${{ steps.publish-client.outputs.url }}
steps:
- name: Checkout git repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
- name: Setup Node with caching
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "pnpm"
- name: Install dependencies
run: |
pnpm install --frozen-lockfile --strict-peer-dependencies
pnpm install -g wrangler
- name: Build
run: pnpm --filter ./apps/client build
- name: Publish client to cloudflare
id: publish-client
working-directory: apps/client/
run: |
if [[ "${{ github.ref }}" =~ refs/pull/.+ ]]; then
# Pull requests deploy to their own staging environments
: "${{ github.ref }}"
: ${_%%\/merge} # Remove 'merge' at the end
: ${_//refs\/pull\/} # Remove 'refs' at the beginning
TARGET="PR-${_}"
else
TARGET="${{ github.ref_name }}"
fi
# Use wrangler to manually deploy to cloudflare
wrangler pages publish www/ \
--project-name=$CLOUDFLARE_PAGES_PROJECT \
--branch="$TARGET" \
--commit-dirty=true | tee w.out
# Parse the output URL from the wrangler output
TARGET_URL=$(grep -oE "https?://.+\.pages\.dev" w.out | tail -n1)
if [[ "$TARGET_URL" ]]; then
echo "url=$TARGET_URL" >> $GITHUB_OUTPUT
else
echo "Failed to find URL for deployment"
exit 1
fi
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT }}