Skip to content

Commit

Permalink
chore: update github action (#84)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <[email protected]>
  • Loading branch information
ruibaby committed Oct 8, 2023
1 parent bc4de5f commit 84345ef
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
59 changes: 58 additions & 1 deletion .github/workflows/workflow.yaml
Expand Up @@ -2,10 +2,20 @@ name: Build Plugin JAR File

on:
push:
branches: [ main ]
branches:
- main
paths:
- "**"
- "!**.md"
release:
types:
- created
pull_request:
branches:
- main
paths:
- "**"
- "!**.md"

jobs:
build:
Expand All @@ -20,6 +30,30 @@ jobs:
distribution: 'temurin'
cache: 'gradle'
java-version: 17
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8
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('**/widget/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Frontend Dependencies
run: |
./gradlew pnpmInstall
- name: Build with Gradle
run: |
# Set the version with tag name when releasing
Expand Down Expand Up @@ -79,3 +113,26 @@ jobs:
name: artifactName,
data: await fs.readFile(artifactPathName)
});
app-store-release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Download plugin-s3 jar
uses: actions/download-artifact@v2
with:
name: plugin-s3
path: build/libs
- name: Sync to Halo App Store
uses: halo-sigs/app-store-release-action@main
with:
github-token: ${{secrets.GITHUB_TOKEN}}
app-id: ${{secrets.APP_ID}}
release-id: ${{ github.event.release.id }}
assets-dir: "build/libs"
halo-username: ${{ secrets.HALO_USERNAME }}
halo-password: ${{ secrets.HALO_PASSWORD }}
11 changes: 2 additions & 9 deletions build.gradle
@@ -1,6 +1,6 @@
plugins {
id 'java'
id "com.github.node-gradle.node" version "3.3.0"
id "com.github.node-gradle.node" version "5.0.0"
id "io.freefair.lombok" version "8.0.1"
id "run.halo.plugin.devtools" version "0.0.6"
}
Expand Down Expand Up @@ -52,18 +52,11 @@ node {
nodeProjectDir = file("${project.projectDir}/console")
}

task buildFrontend(type: NpxTask) {
command = 'pnpm'
task buildFrontend(type: PnpmTask) {
args = ['build']
}

task pnpmInstall(type: NpxTask) {
command = "pnpm"
args = ["install"]
}

build {
// build frontend before build
tasks.getByName('compileJava').dependsOn('buildFrontend')
tasks.getByName("buildFrontend").dependsOn("pnpmInstall")
}

0 comments on commit 84345ef

Please sign in to comment.