update dependencies #3492
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: Build and deploy | |
on: [ push, pull_request ] | |
env: | |
CI: true | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "us-east-1" | |
jobs: | |
deploy: | |
environment: CI | |
name: build and deploy to AWS | |
runs-on: ubuntu-latest | |
steps: | |
- uses: pnpm/[email protected] | |
with: | |
version: 9.9.0 | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Node.js 18.x | |
id: install_pnpm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'pnpm' | |
- name: echo npm dest | |
run: echo "pnpm installed in ${{steps.install_pnpm.outputs.dest}}" | |
- name: Cache pnpm modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/.pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Creating .npmrc | |
run: | | |
"${GITHUB_WORKSPACE}/scripts/create-npmrc.sh" "${{ secrets.NPM_TOKEN }}" "${{ secrets.GSAP_TOKEN }}" | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GSAP_TOKEN: ${{ secrets.GSAP_TOKEN }} | |
- name: Install Dependencies | |
run: pnpm i --no-frozen-lockfile | |
- name: Build App | |
run: pnpm build | |
- name: run architect deploy | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request' | |
working-directory: apps/frontendsupport | |
run: | | |
# N.Virginia us-east-1 | |
pnpm deploy:web | |
node ./replace-workspace-protocol-by-version.mjs ./pruned/package.json | |
cd ./pruned | |
FLAGS="" | |
if [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == true ]]; then | |
FLAGS="--production" | |
else | |
FLAGS="--staging" | |
fi | |
GIT_COMMIT="$(git rev-parse HEAD)" pnpm arc deploy $FLAGS -v --prune | |
env: | |
NODE_ENV: production | |
- name: Invalidate Cloudfront cache staging | |
uses: imehedi/actions-awscli-v2@latest | |
with: | |
args: cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_STAGING_ID }} --paths "/*" --no-cli-pager | |
- name: Invalidate Cloudfront cache Production | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: imehedi/actions-awscli-v2@latest | |
with: | |
args: cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_PRODUCTION_ID }} --paths "/*" --no-cli-pager | |
- name: Run Mozilla Observatory tests | |
if: github.event_name == 'pull_request' | |
uses: simonireilly/[email protected] | |
id: observatory | |
with: | |
web_host: https://staging.frontendrescue.com | |
- name: Create commit comment | |
if: github.event_name == 'pull_request' | |
uses: peter-evans/commit-comment@v3 | |
with: | |
body: '# Branch PR ${{ steps.observatory.outputs.observatory-report }}' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |