Fix blog post ordering (#105) #28
This file contains hidden or 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: Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write # required for OIDC role assumption | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # required for blog post last modified timestamps via git | |
| - name: Bootstrap | |
| uses: ./.github/actions/bootstrap | |
| - name: Build Site | |
| run: yarn build | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.DEPLOYMENT_ROLE_ARN }} | |
| aws-region: us-east-1 | |
| - name: Deploy immutable assets to S3 with cache-control headers | |
| run: | | |
| aws s3 sync --delete --cache-control "max-age=31536000,immutable" ./dist/_assets/ ${{ secrets.S3_BUCKET_URL}}/_assets/ | |
| - name: Deploy remaining files to S3 | |
| run: aws s3 sync --delete ./dist/ ${{ secrets.S3_BUCKET_URL}} | |
| - name: Invalidate CloudFront Distribution | |
| run: | | |
| INVALIDATION_ID=$(aws cloudfront create-invalidation \ | |
| --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \ | |
| --paths "/*" \ | |
| --query 'Invalidation.Id' \ | |
| --output text) | |
| echo "Waiting for invalidation $INVALIDATION_ID to complete..." | |
| aws cloudfront wait invalidation-completed \ | |
| --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \ | |
| --id $INVALIDATION_ID |