diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 245800c..93461eb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,13 +12,6 @@ jobs: name: Build and Deploy runs-on: ubuntu-latest steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/blog' && github.actor != 'dependabot[bot]' }} - with: - aws-access-key-id: ${{ secrets.BLOG_DEPLOYER_AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.BLOG_DEPLOYER_AWS_SECRET_ACCESS_KEY }} - aws-region: 'us-east-1' - name: Checkout code uses: actions/checkout@v4 - name: Set up Python @@ -31,25 +24,13 @@ jobs: run: cfn-lint -t stack.yaml - name: Build site run: swift run - - name: Create S3 Bucket - if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/blog' && github.actor != 'dependabot[bot]' }} - env: - BUCKET: ${{ format('vapor-blog-pulls-pr{0}', github.event.number) }} - run: | - if aws s3api head-bucket --bucket ${BUCKET} 2>/dev/null; then - echo "Bucket already exists" - else - aws s3 mb s3://${BUCKET} - aws s3api delete-public-access-block --bucket ${BUCKET} - aws s3api delete-bucket-ownership-controls --bucket ${BUCKET} - aws s3api put-bucket-website --bucket ${BUCKET} \ - --website-configuration '{"IndexDocument":{"Suffix":"index.html"},"ErrorDocument":{"Key":"404.html"}}' - fi - name: Deploy S3 Website if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/blog' && github.actor != 'dependabot[bot]' }} - uses: brokenhandsio/s3-website-https-pr-action@1.0.0 + uses: brokenhandsio/s3-website-pr-action@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + AWS_ACCESS_KEY_ID: ${{ secrets.BLOG_DEPLOYER_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.BLOG_DEPLOYER_AWS_SECRET_ACCESS_KEY }} with: bucket-prefix: "vapor-blog-pulls" folder-to-copy: "./Output" diff --git a/.github/workflows/prs-closed.yaml b/.github/workflows/prs-closed.yaml index ced7e0e..f9f38df 100644 --- a/.github/workflows/prs-closed.yaml +++ b/.github/workflows/prs-closed.yaml @@ -18,6 +18,7 @@ jobs: steps: - name: Delete Website Bucket - uses: rishabhrao/s3-website-https-pr-action@v1 + uses: brokenhandsio/s3-website-pr-action@v2 with: - bucket-prefix: "vapor-blog-pull" \ No newline at end of file + bucket-prefix: "vapor-blog-pull" + bucket-region: "us-east-1" \ No newline at end of file