From b9a3eb6157b3d5deb663efa2dcf1fae571b1cf8a Mon Sep 17 00:00:00 2001 From: Przemyslaw Bak Date: Wed, 15 Nov 2023 12:24:59 +0100 Subject: [PATCH] ci: move component deployment to separate file --- .github/workflows/deploy-components.yml | 26 +++++++++++++++++++++++++ .github/workflows/deploy-staging.yml | 6 ------ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/deploy-components.yml diff --git a/.github/workflows/deploy-components.yml b/.github/workflows/deploy-components.yml new file mode 100644 index 0000000..011fac5 --- /dev/null +++ b/.github/workflows/deploy-components.yml @@ -0,0 +1,26 @@ +name: Deploy components to S3 +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + environment: staging + steps: + - uses: actions/checkout@v2 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Setup Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: get-npm-version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 + - name: Deploy Components + run: + aws s3 sync ./packages/components s3://${{ secrets.S3_BUCKET_COMPONENT_ITEMS }}/${{steps.package-version.outputs.current-version}} --delete diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index e7bb018..7b13c04 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -18,17 +18,11 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18 - - name: get-npm-version - id: package-version - uses: martinbeentjes/npm-get-version-action@v1.3.1 - name: Install dependencies run: npm ci - name: Build run: npm run build-storybook - name: Deploy run: aws s3 sync ./storybook-static s3://${{ secrets.S3_BUCKET }} --delete - - name: Deploy Components - run: - aws s3 sync ./packages/components s3://${{ secrets.S3_BUCKET_COMPONENT_ITEMS }}/${{steps.package-version.outputs.current-version}} --delete - name: Invalidate Cloudfront run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION }} --paths "/*"