Skip to content

Deploy To Stage Environment #209

Deploy To Stage Environment

Deploy To Stage Environment #209

Workflow file for this run

name: Deploy To Stage Environment
on:
push:
tags:
- "stg-v*"
workflow_dispatch:
jobs:
build:
uses: ./.github/workflows/ci.reusable.build.yml
with:
node-version: "20"
os: "ubuntu-latest"
bundle-deploy:
needs: build
runs-on: ubuntu-latest
env:
CI: true
STAGE: staging
SSH_ADDRESS_STG: ${{ secrets.SSH_ADDRESS_STG }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
DEPLOY_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('stg-0.0.0-{0}-{1}-{2}', github.ref_name, github.run_number, github.run_attempt) }}
steps:
- name: "Git"
uses: actions/checkout@v4
- name: "Nodejs"
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- run: npm ci
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build output (ubuntu-latest, 20)
- name: "SSH"
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: "Bundle info"
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"
run: npm run generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: "Pre-deploy"
run: npm run pre-deploy
- name: "Deploy"
run: npm run deploy:stg
lighthouse:
needs: bundle-deploy
uses: ./.github/workflows/ci.reusable.lighthouse.yml
with:
serverBaseUrl: "https://lh-stage.dzcode.io"
testBaseUrl: "https://stage.dzcode.io"
stage: "staging"
secrets:
LH_SERVER_TOKEN_STG: ${{ secrets.LH_SERVER_TOKEN_STG }}
LH_SERVER_TOKEN_PRD: ${{ secrets.LH_SERVER_TOKEN_PRD }}