From 268b03a6ff44701b9092cfdc02564d3789cab72d Mon Sep 17 00:00:00 2001 From: guqing Date: Fri, 8 Jul 2022 16:06:20 +0800 Subject: [PATCH] feat: add github workflow config --- .github/workflows/workflow.yaml | 53 +++++++++++++++++++++++++++++++++ build.gradle | 1 - 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/workflow.yaml diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 0000000..58ba254 --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,53 @@ +name: Build Plugin JAR + +on: + push: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + cache: 'gradle' + java-version: 17 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: pnpm/action-setup@v2.0.1 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: false + - name: Get pnpm store directory + id: pnpm-cache + run: | + echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/admin-frontend/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Install Frontend Dependencies + run: | + ./gradlew pnpmInstall + - name: Build with Gradle + run: | + ./gradlew clean build -x test + - name: Archive plugin-links jar + uses: actions/upload-artifact@v2 + with: + name: halo-plugin-template + path: | + build/libs + retention-days: 1 diff --git a/build.gradle b/build.gradle index 013752e..878dc37 100644 --- a/build.gradle +++ b/build.gradle @@ -68,5 +68,4 @@ task pnpmInstall (type: NpxTask) { build { // build frontend before build tasks.getByName('compileJava').dependsOn('buildFrontend') - tasks.getByName("buildFrontend").dependsOn("pnpmInstall") }