Skip to content

Deploy

Deploy #46

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
push:
branches:
- alpha
- beta
- legacy
- next
- production
- staging
paths:
- 'packages/**'
- 'apps/**'
env:
HUSKY: 0
jobs:
cache-and-install:
if: ${{ false }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18
- name: Use pnpm
uses: pnpm/action-setup@v2
with:
version: 8
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@v3
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
filter-actions:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
dialtone: ${{ steps.filter.outputs.dialtone }}
dialtone-vue: ${{ steps.filter.outputs.dialtone-vue }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Filter actions by path
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
dialtone:
- 'apps/dialtone-documentation/**'
- 'packages/**'
dialtone-vue:
- 'apps/dialtone-vue3-documentation/**'
- 'packages/**'
get-branch-name:
runs-on: ubuntu-latest
outputs:
current_branch: ${{ steps.branch-name.outputs.current_branch }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
check-dialpad-member:
runs-on: ubuntu-latest
steps:
# Will prevent the rest of the steps from running on fail
- name: Check if user is a dialpad member
uses: octokit/request-action@v2.1.0
with:
route: GET /orgs/dialpad/members/${{ github.actor }}
env:
GITHUB_TOKEN: ${{ secrets.DIALTONE_CI_TOKEN }}
gcp-auth:
if: ${{ false }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Authenticate to Google Cloud'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.DIALTONE_GCP_SA_KEY }}
deploy-dialtone:
needs: [check-dialpad-member, get-branch-name, filter-actions]
if: ${{ needs.filter-actions.outputs.dialtone == 'true' }}
concurrency: ${{ github.workflow }}-${{ github.ref }}
runs-on: ubuntu-latest
env:
VUEPRESS_BASE_URL: ${{ github.ref == 'refs/heads/production' && '/' || format("/{0}/", needs.get-branch-name.outputs.current_branch) }}

Check failure on line 119 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / Deploy

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 119, Col: 26): Unexpected symbol: '"/{0}/"'. Located at position 56 within expression: github.ref == 'refs/heads/production' && '/' || format("/{0}/", needs.get-branch-name.outputs.current_branch)
# VUEPRESS_BASE_URL: ${{ fromJSON('[format("/{0}/", needs.get-branch-name.outputs.current_branch), "/"]')[github.ref == 'refs/heads/production'] }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18
- name: Use pnpm
uses: pnpm/action-setup@v2
with:
version: 8
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@v3
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
- name: Build Dialtone library and documentation site
run: npx nx run --verbose dialtone-documentation:build
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
version: '>= 363.0.0'
- name: 'Use gcloud CLI'
run: 'gcloud info'
# - name: Deploy Dialtone to GCP
# if: ${{ github.ref != 'refs/heads/production' }}
# uses: google-github-actions/upload-cloud-storage@v1
# with:
# path: apps/dialtone-documentation/docs/.vuepress/dist
# destination: "dialtone.dialpad.com" # /${{ steps.branch-name.outputs.current_branch }}
# parent: false
#
# - name: Deploy to GitHub Pages
# if: ${{ github.ref == 'refs/heads/production' }}
# uses: JamesIves/github-pages-deploy-action@v4.2.5
# with:
# branch: gh-pages
# folder: apps/dialtone-documentation/docs/.vuepress/dist
# clean-exclude: |
# alpha
# beta
# deploy-previews
# legacy
# next
# staging
# deploy-dialtone-vue:
# needs: cache-and-install
# if: ${{ needs.cache-and-install.outputs.dialtone-vue == 'true' }}
# concurrency: ${{ github.workflow }}-${{ github.ref }}
# runs-on: ubuntu-latest
# steps:
# - name: Build Dialtone Vue library and docsite
# run: npx nx run --verbose dialtone-vue3-documentation:build
#
# - name: Deploy Dialtone Vue to GitHub Pages
# uses: JamesIves/github-pages-deploy-action@v4.2.5
# with:
# branch: gh-pages
# folder: apps/dialtone-vue3-documentation/storybook-static
# target-folder: ${{ steps.branch-name.outputs.current_branch }}