Skip to content

Bump codecov/codecov-action from 5 to 6 #27

Bump codecov/codecov-action from 5 to 6

Bump codecov/codecov-action from 5 to 6 #27

Workflow file for this run

name: Deploy Documentation

Check failure on line 1 in .github/workflows/docs-deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docs-deploy.yml

Invalid workflow file

(Line: 87, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.CLOUDFRONT_DISTRIBUTION_ID != ''
on:
push:
branches: [main]
paths:
- 'docs/**'
- '.github/workflows/docs-deploy.yml'
- 'package.json'
- 'package-lock.json'
pull_request:
branches: [main]
paths:
- 'docs/**'
- 'package.json'
- 'package-lock.json'
workflow_dispatch:
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build documentation
run: npm run docs:build
- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: docs-dist
path: docs/.vitepress/dist/
retention-days: 1
deploy:
name: Deploy to AWS S3
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
id-token: write
contents: read
steps:
- name: Download build artifact
uses: actions/download-artifact@v7
with:
name: docs-dist
path: dist/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: us-east-2
- name: Determine S3 bucket name
id: bucket
run: |
BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')
BUCKET_NAME="php-k8s-${BRANCH}-us-east-2-${{ secrets.AWS_ACCOUNT_ID }}"
echo "name=${BUCKET_NAME}" >> $GITHUB_OUTPUT
echo "Deploying to bucket: ${BUCKET_NAME}"
- name: Sync to S3
run: |
aws s3 sync dist/ s3://${{ steps.bucket.outputs.name }}/ \
--delete \
--cache-control "public, max-age=3600" \
--exclude "*.map"
- name: Invalidate CloudFront cache
if: secrets.CLOUDFRONT_DISTRIBUTION_ID != ''
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"
- name: Deployment summary
run: |
echo "### Deployment Complete :rocket:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Documentation has been deployed to:" >> $GITHUB_STEP_SUMMARY
echo "- **S3 Bucket**: \`${{ steps.bucket.outputs.name }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **URL**: https://php-k8s.cuppett.dev" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "CloudFront cache has been invalidated." >> $GITHUB_STEP_SUMMARY