From bcc780be7e064cfd4320d919da23e6abd7158399 Mon Sep 17 00:00:00 2001 From: Giacomo Licari Date: Wed, 10 Jan 2024 14:53:41 +0100 Subject: [PATCH] Improve CI --- .github/workflows/deploy.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b65f206..e1bf82d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,8 @@ on: branches: - main - dev - - release + tags: + - v* # Launches build when release is published release: types: [published] @@ -57,7 +58,7 @@ jobs: - name: Configure AWS Development credentials uses: aws-actions/configure-aws-credentials@v1 - if: ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' ) + if: startsWith(github.event.ref, 'refs/heads/dev') || github.event_name == 'refs/heads/main' with: aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} @@ -65,7 +66,7 @@ jobs: - name: Configure AWS Production credentials uses: aws-actions/configure-aws-credentials@v1 - if: ( github.ref == 'refs/heads/release' ) + if: startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'release' with: aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }} @@ -90,7 +91,7 @@ jobs: # Script to deploy to release environment - name: 'Deploy to S3: Release' working-directory: ./website - if: github.ref == 'refs/heads/release' + if: startsWith(github.event.ref, 'refs/tags/v') || github.event_name == 'release' run: | aws s3 sync build/ s3://${{ secrets.RELEASE_BUCKET_NAME }} --delete --exclude "*.html" --exclude "sitemap.xml" --cache-control max-age=86400,public aws s3 sync build/ s3://${{ secrets.RELEASE_BUCKET_NAME }} --delete --exclude "*" --include "*.html" --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html