Skip to content

Commit

Permalink
ci: dialtone docsite deployment (#3)
Browse files Browse the repository at this point in the history
* ci: dialtone docsite deployment

* ci: improve pnpm cache
  • Loading branch information
juliodialpad authored Oct 31, 2023
1 parent 2258663 commit bbbdc4f
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 74 deletions.
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Description
Provide a description of what this pull request is adding, updating, extending, or removing. If this request is addressing an issue, please link to that issue.

## Pull Request Checklist

- [ ] Ask the contributors if a similar effort is already in process or has been solved.
- [ ] Review the [contribution guidelines](https://github.com/dialpad/dialtone/blob/staging/.github/CONTRIBUTING.md).
- [ ] Use `staging` as your pull request's base branch. (All PRs using `production` as its base branch will be declined).
- [ ] Ensure all `gulp` scripts successfully compile.
- [ ] Update, remove, or extend all affected documentation.
- [ ] Ensure no private Dialpad links or info are in the code or pull request description (Dialtone is a public repo!).

## Obligatory GIF (super important!)
![](path/to/gif)
21 changes: 21 additions & 0 deletions .github/release_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--- Please remove any sections that don't apply to this release -->

## Adds
* [My addition](https://github.com/dialpad/dialtone/pull/PULL_REQUEST_ID)
* Optional additional info about my addition
* Optional additional info about my addition
* [My other addition](https://github.com/dialpad/dialtone/pull/PULL_REQUEST_ID)
* Optional additional info about my addition
* Optional additional info about my addition

## Updates
* [My update](https://github.com/dialpad/dialtone/pull/PULL_REQUEST_ID)
* Optional additional info about my update
* Optional additional info about my update
* [My other update](https://github.com/dialpad/dialtone/pull/PULL_REQUEST_ID)
* Optional additional info about my update
* Optional additional info about my update

## Fixes
* [My fix](https://github.com/dialpad/dialtone/pull/PULL_REQUEST_ID)
* [My other fix](https://github.com/dialpad/dialtone/pull/PULL_REQUEST_ID)
86 changes: 46 additions & 40 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Deploy Preview

on:
pull_request:
paths:
- 'packages/dialtone/**'
paths:
- 'packages/dialtone/**'

env:
HUSKY: 0
Expand All @@ -13,47 +13,53 @@ jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 18 ]

defaults:
run:
working-directory: ${{ github.workspace }}

steps:
- uses: actions/checkout@v3
with:
ref: "refs/pull/${{ github.event.pull_request.number }}/merge"

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: Install PNPM
uses: pnpm/action-setup@v2.2.1
with:
version: '8'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build library and docsite
run: npx nx run --verbose dialtone:build-docs -- --deploySubdir /design-system/deploy-previews/pr-${{github.event.pull_request.number}}/

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: packages/dialtone/docs/.vuepress/dist
target-folder: deploy-previews/pr-${{ github.event.pull_request.number }}

- name: Add Message
uses: mshick/add-pr-comment@v1
env:
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
✔️ Deploy Preview ready!
😎 Browse the preview: https://dialpad.github.io/design-system/deploy-previews/pr-${{ github.event.pull_request.number }}
🔨 If you experience an SSL issue then wait 2 minutes and try again.
allow-repeats: true
- uses: actions/checkout@v3
with:
ref: "refs/pull/${{ github.event.pull_request.number }}/merge"

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build library and docsite
run: npx nx run --verbose dialtone:build-docs -- --deploySubdir /design-system/deploy-previews/pr-${{github.event.pull_request.number}}/

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: packages/dialtone/docs/.vuepress/dist
target-folder: deploy-previews/pr-${{ github.event.pull_request.number }}

- name: Add Message
uses: mshick/add-pr-comment@v1
env:
BUILD_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
✔️ Deploy Preview ready!
😎 Browse the preview: https://dialpad.github.io/design-system/deploy-previews/pr-${{ github.event.pull_request.number }}
🔨 If you experience an SSL issue then wait 2 minutes and try again.
allow-repeats: true
107 changes: 107 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Deploy

on:
workflow_dispatch:
push:
branches:
- production
- alpha
- beta
- staging
paths:
- 'packages/dialtone/**'

env:
HUSKY: 0

jobs:
deploy:
concurrency: ${{ github.workflow }}-${{ github.ref }}
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 18 ]

defaults:
run:
working-directory: ${{ github.workspace }}

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: parse branch from ref
id: branch
run: echo ::set-output name=BRANCH::${GITHUB_REF/refs\/heads\//}

# 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 }}

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build library and docsite (Staging)
if: ${{ github.ref == 'refs/heads/staging' }}
run: npx nx run --verbose dialtone:build-docs -- --deploySubdir /design-system/staging/

- name: Deploy to GitHub Pages (Staging)
if: ${{ github.ref == 'refs/heads/staging' }}
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: packages/dialtone/docs/.vuepress/dist
target-folder: staging

- name: Build library and docsite (Next)
if: ${{ github.ref == 'refs/heads/next' }}
run: npx nx run --verbose dialtone:build-docs -- --deploySubdir /design-system/next/

- name: Deploy to GitHub Pages (Next)
if: ${{ github.ref == 'refs/heads/next' }}
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: packages/dialtone/docs/.vuepress/dist
target-folder: next

- name: Build library and docsite (Legacy)
if: ${{ github.ref == 'refs/heads/legacy' }}
run: npx nx run --verbose dialtone:build-docs -- --deploySubdir /design-system/legacy/

- name: Deploy to GitHub Pages (Legacy)
if: ${{ github.ref == 'refs/heads/legacy' }}
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: packages/dialtone/docs/.vuepress/dist
target-folder: legacy

- name: Build library and docsite
if: ${{ github.ref == 'refs/heads/production' }}
run: npx nx run --verbose dialtone:build-docs -- --deploySubdir /design-system/

- 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: packages/dialtone/docs/.vuepress/dist
clean-exclude: |
deploy-previews
legacy
staging
next
31 changes: 15 additions & 16 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,29 @@ on:
jobs:
commitlint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18 ]

defaults:
run:
working-directory: ${{ github.workspace }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# we need + 1 commit
fetch-depth: 2

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: Install PNPM
uses: pnpm/action-setup@v2.2.1
- uses: pnpm/action-setup@v2
with:
version: '8'
version: 8

- name: Use the node_modules cache if available [pnpm]
uses: actions/cache@v2
id: npm-cache
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down
31 changes: 13 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ jobs:
release:
concurrency: ${{ github.workflow }}-${{ github.ref }}
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 18 ]

defaults:
run:
working-directory: ${{ github.workspace }}

steps:
- name: Check out branch
uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js
uses: actions/setup-node@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: parse branch from ref
id: branch
Expand All @@ -41,19 +49,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.DIALTONE_CI_TOKEN }}

- name: Install PNPM
uses: pnpm/action-setup@v2.2.1
with:
version: '8'

- name: Use the node_modules cache if available [pnpm]
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand Down

0 comments on commit bbbdc4f

Please sign in to comment.