Fix CICD remove artifact #2
Workflow file for this run
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: Build and Deploy Static Site to S3 | |
| on: | |
| push: | |
| branches: | |
| - hugo | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: "s3-deploy" | |
| cancel-in-progress: false | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '24.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build site | |
| run: npm run build | |
| - name: Fix permissions | |
| run: | | |
| chmod -c -R +rX "public/" | while read line; do | |
| echo "::warning title=Invalid file permissions automatically fixed::$line" | |
| done | |
| - name: Upload site to S3 | |
| uses: shallwefootball/s3-upload-action@master | |
| with: | |
| aws_key_id: ${{ secrets.AWS_KEY_ID }} | |
| aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws_bucket: ${{ secrets.AWS_BUCKET }} | |
| source_dir: 'public' | |
| destination_dir: '' | |
| - name: Invalidate CloudFront cache | |
| uses: chetan/invalidate-cloudfront-action@master | |
| env: | |
| DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }} | |
| PATHS: '/*' | |
| AWS_REGION: 'eu-west-3' | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |