Skip to content

Commit

Permalink
add github workflows to new cms-react repo
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatto committed Feb 1, 2024
1 parent 1c02178 commit 3fcbdaa
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Deploy docs to GH Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

defaults:
run:
working-directory: docs

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn # or pnpm / yarn
cache-dependency-path: 'docs/yarn.lock'
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: yarn # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: |
yarn build
touch .vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
41 changes: 41 additions & 0 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Project build and deploy test

on:
push:
branches:
- main

jobs:
deploy-test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
node: [18]

runs-on: ${{ matrix.os }}

defaults:
run:
working-directory: examples/hello-world/hello-world-project
shell: bash

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Rename project
run: |
sed -i 's/hello-world-project/hello-world-project-os-${{ matrix.os }}-node-${{ matrix.node }}/g' hsproject.json
echo ""
echo "After rename"
cat hsproject.json
- name: Build and deploy
env:
HUBSPOT_PORTAL_ID: ${{ secrets.hubspot_portal_id }}
HUBSPOT_PERSONAL_ACCESS_KEY: ${{ secrets.hubspot_personal_access_key }}
run: |
npx --yes --package=@hubspot/cli@latest --call='hs project upload . --use-env'
51 changes: 51 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CMS dev server test

on: push

jobs:
dev-server-smoke-test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
node: [16, 18]

runs-on: ${{ matrix.os }}

defaults:
run:
working-directory: examples/hello-world
shell: bash

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: NPM install
run: |
npm install
- name: Run dev server
run: |
npm run start &
- name: Basic dev server home test
run: |
curl --no-progress-meter http://localhost:3000/ --output home.txt
ls -lh
wc home.txt
echo "Grepping home.txt"
grep -q '/partial/Cars' home.txt
echo "-----"
cat home.txt
- name: Basic dev server partial test
run: |
curl --no-progress-meter http://localhost:3000/partial/Cars --output Cars.txt
echo "Grepping Cars.txt"
grep -q 'Volkswagen' Cars.txt
echo "-----"
cat Cars.txt

0 comments on commit 3fcbdaa

Please sign in to comment.