Skip to content

Commit

Permalink
reuse workflows in deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ZibanPirate committed Sep 14, 2024
1 parent f3aba19 commit 9e4e176
Showing 1 changed file with 26 additions and 38 deletions.
64 changes: 26 additions & 38 deletions .github/workflows/cd.deploy.stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 9e4e176

Please sign in to comment.