Skip to content

Commit

Permalink
ci: add build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lingbopro committed Dec 29, 2024
1 parent d041ee7 commit 5d6efe5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build

on:
push:
branches:
- main
pull_request:

jobs:
build:
name: Build
uses: ./.github/workflows/reusable-build.yaml
49 changes: 49 additions & 0 deletions .github/workflows/reusable-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build (reusable)

on:
workflow_call:
inputs:
node-version:
description: 'Node.js version'
type: string
required: false
default: 22.x
pnpm-version:
description: 'pnpm version'
type: string
required: false
default: 9.12.3
outputs:
artifact-url:
description: Artifact URL of the builded repo
value: ${{ jobs.build.outputs.artifact-url }}

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up pnpm ${{ inputs.pnpm-version }}
uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
run_install: false
- name: Set up Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Upload artifact
id: upload-artifact
uses: actions/upload-artifact@v4
with:
name: build-result
path: ./

0 comments on commit 5d6efe5

Please sign in to comment.