Skip to content

Commit

Permalink
ci: add build pipeline for easier debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Heywood <[email protected]>
  • Loading branch information
lachieh committed Jan 28, 2025
1 parent 9d14ffe commit affc07b
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

concurrency:
group: docusaurus-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
uses: ./.github/workflows/ci_build.yml

ci-check:
needs: [build]
if: ${{ always() }}
uses: ./.github/workflows/workflow_check.yml
with:
pass-condition: ${{ contains(needs.*.result, 'failure') == false }}
33 changes: 33 additions & 0 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI - Build

on:
workflow_call: {}

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Setup Node.js
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with:
cache: npm

- name: Install
run: npm install

- name: Build
run: npm run build

- name: Upload Build
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: build-assets
path: |
build/
42 changes: 42 additions & 0 deletions .github/workflows/workflow_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: simple-check

on:
workflow_call:
inputs:
pass-condition:
type: boolean
description: 'The condition to check'
required: true
fail-job-on-condition:
description: 'Whether to fail the job if the condition is true'
type: boolean
required: false
default: true

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check Condition
shell: bash
run: |
# Check the condition
if [[ "${{ inputs.pass-condition }}" == 'true' ]]; then
echo "Condition is true"
echo "RESULT=success" >> $GITHUB_ENV
else
echo "Condition is false"
echo "RESULT=failure" >> $GITHUB_ENV
fi
- name: Job Result
id: result
shell: bash
if: ${{ inputs.fail-job-on-condition }}
run: |
# Set the output
if [[ $RESULT == 'failure' ]]; then
echo "::error ::Condition failed"
exit 1
else
exit 0
fi

0 comments on commit affc07b

Please sign in to comment.