Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/deploy-to-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy to Production

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build project
run: |
gulp build
gulp bundle --tag prebid-full --modules=modules-full.json
gulp bundle --tag prebid-no-user-sync --modules=modules-no-user-sync.json
gulp bundle --tag prebid-adzep --modules=modules-adzep.json
Comment on lines +27 to +30

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run gulp through npx in deployment workflow

This step invokes gulp directly, but after npm ci the CLI is only guaranteed under node_modules/.bin; in a plain GitHub Actions run shell that path is not reliably on PATH, so the job can fail with gulp: command not found before any artifacts are built or uploaded. I checked this workflow and compared it with existing repo workflows, which call npx gulp ... for the same reason.

Useful? React with 👍 / 👎.


- name: Upload to S3 Bucket
run: |
aws s3 cp build/dist/prebid.prebid-full.js s3://${{ vars.AWS_S3_BUCKET }}/prebid.js \
--region ${{ vars.AWS_S3_REGION }} \
--content-type "text/javascript; charset=UTF-8" \
--cache-control "public, max-age=1800, stale-while-revalidate=3600" \
--content-disposition 'attachment; filename="f.txt"'

aws s3 cp build/dist/prebid.prebid-no-user-sync.js s3://${{ vars.AWS_S3_BUCKET }}/prebid-no-user-sync.js \
--region ${{ vars.AWS_S3_REGION }} \
--content-type "text/javascript; charset=UTF-8" \
--cache-control "public, max-age=1800, stale-while-revalidate=3600" \
--content-disposition 'attachment; filename="f.txt"'

aws s3 cp build/dist/prebid.prebid-adzep.js s3://${{ vars.AWS_S3_BUCKET }}/prebid-adzep.js \
--region ${{ vars.AWS_S3_REGION }} \
--content-type "text/javascript; charset=UTF-8" \
--cache-control "public, max-age=1800, stale-while-revalidate=3600" \
--content-disposition 'attachment; filename="f.txt"'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Purge Cloudflare Cache
run: |
response=$(curl -s -X POST "https://api.cloudflare.com/client/v4/zones/${{ vars.CLOUDFLARE_ZONE_ID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"files":["https://tag.adpulse.com.br/prebid.js", "https://tag.adpulse.com.br/prebid-no-user-sync.js", "https://tag.adpulse.com.br/prebid-adzep.js"]}')
echo "$response"
if ! echo "$response" | grep -q '"success":true'; then
echo "Cloudflare cache purge failed"
exit 1
fi
Loading