Skip to content

docs: DLT-1796 move storybook to doc site - Link to Pagination #1654

docs: DLT-1796 move storybook to doc site - Link to Pagination

docs: DLT-1796 move storybook to doc site - Link to Pagination #1654

Workflow file for this run

name: Deploy Preview
on:
workflow_dispatch:
pull_request:
paths:
- 'packages/**'
- 'apps/**'
env:
HUSKY: 0
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
filter-actions:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
dialtone: ${{ steps.filter.outputs.dialtone }}
dialtone-vue-2: ${{ steps.filter.outputs.dialtone-vue-2 }}
dialtone-vue-3: ${{ steps.filter.outputs.dialtone-vue-3 }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Filter actions by path
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
dialtone:
- 'apps/dialtone-documentation/**'
- 'packages/**'
dialtone-vue-2:
- 'packages/**'
dialtone-vue-3:
- 'packages/**'
deploy:
needs: filter-actions
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
pull-requests: write
env:
VUEPRESS_BASE_URL: /deploy-previews/pr-${{ github.event.pull_request.number }}/
DIALTONE_BUCKET_DIRECTORY: dialtone.dialpad.com/deploy-previews/pr-${{ github.event.pull_request.number }}/
DIALTONE_VUE_2_BUCKET_DIRECTORY: dialtone.dialpad.com/vue/deploy-previews/pr-${{ github.event.pull_request.number }}/
DIALTONE_VUE_3_BUCKET_DIRECTORY: dialtone.dialpad.com/vue3/deploy-previews/pr-${{ github.event.pull_request.number }}/
steps:
- uses: actions/checkout@v4
with:
ref: "refs/pull/${{ github.event.pull_request.number }}/merge"
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Use pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: "${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
# ---------- #
# Build docs #
# ---------- #
- name: Build Dialtone library and documentation site
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
run: pnpm nx run --verbose dialtone-documentation:build-docs
- name: Build Dialtone-vue 2 library and documentation site
if: ${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' }}
run: pnpm nx run --verbose dialtone-vue2:build-docs
- name: Build Dialtone-vue 3 library and documentation site
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
run: pnpm nx run --verbose dialtone-vue3:build-docs
# --------- #
# Setup GCP #
# --------- #
- id: auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.DIALTONE_GCP_WIP }}
service_account: ${{ secrets.DIALTONE_GCP_SA }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
# -------------- #
# Cleanup bucket #
# -------------- #
- name: Clean up bucket Dialtone
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_BUCKET_DIRECTORY) }}
- name: Clean up bucket Dialtone Vue 2
if: ${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_VUE_2_BUCKET_DIRECTORY) }}
- name: Clean up bucket Dialtone Vue 3
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
continue-on-error: true
run: gcloud storage rm --recursive ${{ format('gs://{0}', env.DIALTONE_VUE_3_BUCKET_DIRECTORY) }}
# ---------- #
# GCP Upload #
# ---------- #
- name: Upload Dialtone to GCP
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
uses: google-github-actions/upload-cloud-storage@v2
with:
path: apps/dialtone-documentation/docs/.vuepress/dist
destination: ${{ env.DIALTONE_BUCKET_DIRECTORY }}
parent: false
- name: Upload Dialtone-vue 2 to GCP
if: ${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' }}
uses: google-github-actions/upload-cloud-storage@v2
with:
path: packages/dialtone-vue2/storybook-static
destination: ${{ env.DIALTONE_VUE_2_BUCKET_DIRECTORY }}
parent: false
- name: Upload Dialtone-vue 3 to GCP
if: ${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' }}
uses: google-github-actions/upload-cloud-storage@v2
with:
path: packages/dialtone-vue3/storybook-static
destination: ${{ env.DIALTONE_VUE_3_BUCKET_DIRECTORY }}
parent: false
# ------------- #
# Post messages #
# ------------- #
- name: Add preview ready message
if: (needs.filter-actions.outputs.dialtone == 'true' || needs.filter-actions.outputs.dialtone-vue-2 == 'true' || needs.filter-actions.outputs.dialtone-vue-3 == 'true' )
uses: mshick/add-pr-comment@v2
env:
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
✔️ Deploy previews ready!
${{ needs.filter-actions.outputs.dialtone == 'true' && format('😎 Dialtone preview: https://{0}', env.DIALTONE_BUCKET_DIRECTORY) || '' }}
${{ needs.filter-actions.outputs.dialtone-vue-2 == 'true' && format('😎 Dialtone-vue 2 preview: https://{0}', env.DIALTONE_VUE_2_BUCKET_DIRECTORY) || '' }}
${{ needs.filter-actions.outputs.dialtone-vue-3 == 'true' && format('😎 Dialtone-vue 3 the preview: https://{0}', env.DIALTONE_VUE_3_BUCKET_DIRECTORY) || '' }}
message-id: 'deploy-preview-message'
refresh-message-position: true