Skip to content

Commit

Permalink
pipelines (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
wandyezj authored May 16, 2024
1 parent 5184a81 commit b02f5ca
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Build Job to be used between main and pages workflows
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build

on:
# Reusable Workflow
workflow_call:
inputs:
# Run end to end tests
test:
required: false
type: boolean
default: false

# Upload built files as static artifact
upload:
required: false
type: boolean
default: false

jobs:
build:
timeout-minutes: 10
# Match Development Operating System
runs-on: ubuntu-latest
steps:
# Setup
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
# Match Development Node Version
node-version: '20.x'

# Tool Versions
- name: Node Version
run: node --version

- name: NPM Version
run: npm --version

# Package Setup
- name: clean install
run: npm ci

# 'npm run build' broken into separate steps
# - name: clean
# run: npm run clean

# - name: style
# run: npm run style-check

# - name: spell-check
# run: npm run spell-check --if-present

# - name: lint
# run: npm run lint

# - name: compile
# run: npm run compile

- name: build
run: npm run build

# - name: Upload static files as artifact
# if: inputs.upload
# uses: actions/upload-pages-artifact@v1
# with:
# path: dist/

- name: Upload static files as artifact
if: inputs.upload
uses: actions/upload-pages-artifact@v1
with:
path: packages/editor/build/
## end to end tests
# - name: Install Playwright Browsers
# if: inputs.test
# run: npm run playwright-install
# - name: Run Playwright tests
# if: inputs.test
# run: npm run playwright-test
# - uses: actions/upload-artifact@v3
# if: inputs.test
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Main workflow to keep branches clean

name: Main

on:

push:
branches:
# main branch CI
- 'main'
# Any branch
- '*'

# Run on pull request
pull_request:
types: [ opened, synchronize ]

# Cancel current workflow if there is already one running
concurrency:
group: ${{ github.workflow }} ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
uses: ./.github/workflows/build.yml
with:
test: true
47 changes: 47 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Publish to GitHub pages

# https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#creating-a-custom-github-actions-workflow-to-publish-your-site

name: Pages

on:
# main branch CI
push:
branches:
- 'main'

# Manual
workflow_dispatch:

# Only allow one pages workflow to run at a time
concurrency:
group: ${{ github.workflow }}

jobs:

build:
uses: ./.github/workflows/build.yml
with:
upload: true

# Deploy job
deploy:
# Add a dependency to the build job
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

0 comments on commit b02f5ca

Please sign in to comment.