From fca9f93bcb83fd0ecf72614bbcf7dbe63dbd1cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dabiel=20Gonz=C3=A1lez=20Ramos?= Date: Tue, 19 Dec 2023 12:57:50 +0200 Subject: [PATCH] chore(CI): move Storybook deploy to publish.yml workflow --- .github/workflows/deploy.yml | 45 ----------------------------------- .github/workflows/publish.yml | 28 +++++++++++----------- 2 files changed, 14 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index b03b8ffe6..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Deploy Storybook to GitHub Pages - -on: - push: - branches: [main] - -env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - -permissions: - contents: read - pages: write - id-token: write - -jobs: - main: - name: 📘 Deploy Storybook to GitHub Pages - runs-on: ubuntu-latest - env: - NX_BRANCH: ${{ github.head_ref || github.ref_name }} - steps: - - name: 🛎 Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: 🔍 Check GH_TOKEN - uses: ./.github/actions/check-token - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 🛠 Setup Volta - uses: volta-cli/action@v4 - - - name: 💫 Load and cache dependencies - uses: ./.github/actions/cache-deps - - - name: 🚚 Deploy to GitHub Pages - uses: bitovi/github-actions-storybook-to-github-pages@v1.0.2 - with: - checkout: false - path: ./dist/storybook/beeq - install_command: npm i - build_command: npm run build --skip-nx-cache diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 75d50e221..b6cf90889 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish NPM packages +name: NPM publish and Storybook deploy on: release: @@ -8,9 +8,14 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} +permissions: + contents: read + pages: write + id-token: write + jobs: main: - name: 📦 Publish NPM packages + name: 📦 NPM publish and 📘 Storybook deploy runs-on: ubuntu-latest env: NX_BRANCH: ${{ github.head_ref || github.ref_name }} @@ -42,18 +47,13 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: 🚀 Publish to NPM registry + - name: 🚀 Publish BEEQ to NPM registry run: npx nx run-many -t publish -p tag:publishable --parallel=1 --output-style=stream-without-prefixes - - name: 🔐 Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 + - name: 🚚 Deploy BEEQ Storybook to GitHub Pages + uses: bitovi/github-actions-storybook-to-github-pages@v1.0.2 with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{secrets.AWS_S3_BUCKET_REGION}} - - - name: 🚚 Deploy to AWS S3 - run: aws s3 sync dist/storybook/beeq/ s3://${{secrets.AWS_S3_BUCKET}}/ --delete --output table - - - name: 🚮 Invalidate AWS CloudFront distribution cache - run: aws cloudfront create-invalidation --distribution-id ${{secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID}} --paths "/*" --output table --cli-connect-timeout 15 + build_command: npm run build + checkout: false + install_command: npm ci + path: ./dist/storybook/beeq