Skip to content

Commit

Permalink
Merge branch 'main' into pgollucci/ci/more_to_p6m7g8actionsnextupgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 1, 2024
2 parents 0fb39e0 + 9a8705c commit f6820cd
Showing 1 changed file with 12 additions and 52 deletions.
64 changes: 12 additions & 52 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Deploy

on:
push:
branches: [ main ]
branches:
- main
workflow_dispatch: {}

jobs:
deploy:
Expand All @@ -11,55 +13,13 @@ jobs:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Install Node.js
run: |
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
echo /opt/hostedtoolcache/node/22.10.0/x64/bin >> $GITHUB_PATH
- name: Check node
run: |
ls -alFh /opt/hostedtoolcache/node/
echo $PATH
which node
which npm
node -v
npm -v
- name: Restore NPM node_modules
uses: actions/cache/[email protected]
- name: Next JS Build and Deploy
uses: p6m7g8-actions/next-deploy@main
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install pnpm and dependencies
run: |
corepack enable
corepack prepare pnpm@latest --activate
pnpm install
- name: Cache NPM dependencies
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Disable Next.js Telemetry
run: echo "NEXT_TELEMETRY_DISABLED=1" >> "$GITHUB_ENV"
- name: Run build
run: pnpm run build
- name: Assume role using OIDC
uses: aws-actions/[email protected]
with:
aws-region: ${{ secrets.CDK_DEPLOY_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: ${{ secrets.AWS_SESSION_NAME }}
- name: Deploy to S3
run: aws s3 sync out s3://${{ secrets.BUCKET_NAME }} --no-progress --follow-symlinks --delete --region ${{ secrets.CDK_DEPLOY_REGION }}
- name: Invalidate CloudFront cache
uses: chetan/[email protected]
env:
AWS_REGION: ${{ secrets.CDK_DEPLOY_REGION }}
DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: '/*'
aws_region: ${{ secrets.CDK_DEPLOY_REGION }}
aws_role: ${{ secrets.AWS_ROLE }}
aws_session_name: ${{ secrets.AWS_SESSION_NAME }}
cdk_deploy_account: ${{ secrets.CDK_DEPLOY_ACCOUNT }}
cdk_deploy_region: ${{ secrets.CDK_DEPLOY_REGION }}
bucket_name: ${{ secrets.BUCKET_NAME }}
cloudfront_distribution_id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}

0 comments on commit f6820cd

Please sign in to comment.