From 9e4e1767743ed8e0b51149d725c21026c49c48f2 Mon Sep 17 00:00:00 2001 From: Zakaria Mansouri Date: Sun, 15 Sep 2024 00:58:50 +0200 Subject: [PATCH] reuse workflows in deploy workflow --- .github/workflows/cd.deploy.stg.yml | 64 ++++++++++++----------------- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/.github/workflows/cd.deploy.stg.yml b/.github/workflows/cd.deploy.stg.yml index 49c511f3a..cfb801435 100644 --- a/.github/workflows/cd.deploy.stg.yml +++ b/.github/workflows/cd.deploy.stg.yml @@ -2,19 +2,22 @@ name: Deploy To Stage Environment on: push: + # @TODO-ZM: to remove + branches: + - "ci-fixes" tags: - "stg-v*" workflow_dispatch: jobs: - install-build-deploy: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - node-version: [20.x] - os: [ubuntu-latest] - + build: + uses: ./.github/workflows/reusable/ci.build.yml + with: + node-version: "20" + os: "ubuntu-latest" + + bundle-deploy: + runs-on: ubuntu-latest env: CI: true STAGE: staging @@ -25,42 +28,27 @@ jobs: steps: - name: "Git" - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: "Nodejs" + uses: actions/setup-node@v4 with: - fetch-depth: 0 + node-version: "20" + cache: "npm" + - run: npm ci + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: build output - name: "SSH" uses: shimataro/ssh-key-action@v2 with: key: ${{ secrets.SSH_KEY }} known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} - - name: "Nodejs" - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: "npm" - - - name: "Install" - shell: bash - run: | - npm ci - - name: "Bundle info" - shell: bash - run: | - npm run generate:bundle-info $DEPLOY_VERSION stage - - - name: "Build" - shell: bash - run: | - npm run build - npx lerna run bundle:alone --scope @dzcode.io/web - + run: npm run generate:bundle-info $DEPLOY_VERSION stage + - name: "Bundle ./web" + run: npx lerna run bundle:alone --scope @dzcode.io/web - name: "Sentry Release" - shell: bash - run: | - npm run generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }} - + run: npm run generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }} - name: "Deploy" - shell: bash - run: | - npm run deploy:stg + run: npm run deploy:stg