Skip to content

Update test-and-deploy.yml #9

Update test-and-deploy.yml

Update test-and-deploy.yml #9

Workflow file for this run

name: Test and Deploy to Netlify
on:
pull_request:
branches:
- main
push:
branches-ignore:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm test
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- name: Trigger Netlify Build via Build Hook with Dynamic Params
run: |
BRANCH_NAME=${GITHUB_REF##*/}
echo "Branch Name: $BRANCH_NAME"
ENCODED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's|/|%2F|g')
echo "Encoded Branch Name: $ENCODED_BRANCH_NAME"
TITLE="${ENCODED_BRANCH_NAME} Branch Deploy"
echo "Title: $TITLE"
curl -X POST "https://api.netlify.com/build_hooks/${{ secrets.TEST_BUILDHOOK }}?trigger_branch=$ENCODED_BRANCH_NAME&trigger_title=$TITLE&clear_cache=true"