-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pgollucci/ci/more_to_p6m7g8actionsnextupgrade
- Loading branch information
Showing
1 changed file
with
12 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ name: Deploy | |
|
||
on: | ||
push: | ||
branches: [ main ] | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
deploy: | ||
|
@@ -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 }} |