Skip to content

Commit

Permalink
Merge pull request #478 from PBH-BTN/master
Browse files Browse the repository at this point in the history
v6.2.2
  • Loading branch information
Ghost-chu authored Sep 16, 2024
2 parents 37a1d45 + fba0ada commit 4b7db22
Show file tree
Hide file tree
Showing 117 changed files with 2,808 additions and 1,220 deletions.
8 changes: 6 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ body:
required: false
- label: "JAR 包直接启动 (Start via .JAR directly)"
required: false
validations:
required: true
- label: "群晖 DSM 套件 (Synology .spk package)"
required: false
- label: "Debian 软件包 (Debian .deb package)"
required: false
- label: "RedHat/Fedora 软件包 (RedHat/Fedora .rpm package)"
required: false
- type: checkboxes
id: downloaders
attributes:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/build_deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: DEB Package Build

on:
workflow_call:
jobs:
dpkg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: java_info
uses: YunaBraska/java-info-action@main
- uses: actions/download-artifact@v4
with:
name: maven-dist
path: target/
- name: Build Deb package
id: build-deb
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
sed -i "s/<version>/${{ env.PBH_VERSION }}/g" pkg/deb/DEBIAN/control
cp target/PeerBanHelper.jar pkg/deb/usr/lib/peerbanhelper
cd pkg && dpkg -b deb PeerBanHelper_linux_${{ env.PBH_VERSION }}.deb
# 上面那个文件名需要符合收集条件
env:
PBH_VERSION: ${{ steps.java_info.outputs.project_version }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: deb-dist
path: |
pkg/*.deb
2 changes: 1 addition & 1 deletion .github/workflows/build_fe.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build WebUI
name: WebUI CI

on: workflow_call

Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/build_installers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Installer Build

on:
workflow_call:
secrets:
INSTALL4J_LICENSE:
required: true
jobs:
install4jc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: java_info
uses: YunaBraska/java-info-action@main
- uses: actions/download-artifact@v4
with:
name: maven-dist
path: target/
- uses: luangong/setup-install4j@v1
name: Setup Install4j
with:
version: 10.0.8
license: ${{ secrets.INSTALL4J_LICENSE }}
- name: Make installers
run: |
ls /opt/install4j/
/opt/install4j/bin/install4jc -L ${{ secrets.INSTALL4J_LICENSE }} -r ${{ steps.java_info.outputs.project_version }} -d target/media -D jarPath=target/PeerBanHelper.jar install4j/project.install4j
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: installer-dist
path: |
target/media/PeerBanHelper_*
id: project
37 changes: 37 additions & 0 deletions .github/workflows/build_maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Maven Build

on:
workflow_call:
secrets:
INSTALL4J_LICENSE:
required: true
jobs:
WebUI:
uses: ./.github/workflows/build_fe.yml
Maven:
needs: WebUI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: webui-dist
path: src/main/resources/static
- name: Display structure of WebUI dist
run: ls src/main/resources/static
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: 'maven'
cache-dependency-path: '**/pom.xml'
- name: Build with Maven
run: mvn -B clean package --file pom.xml -P thin-sqlite-packaging
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: maven-dist
path: |
target/*.jar
target/media/*.exe
id: project
31 changes: 31 additions & 0 deletions .github/workflows/build_spk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: SPK Package Build

on:
workflow_call:
jobs:
pkgcreate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: java_info
uses: YunaBraska/java-info-action@main
- uses: actions/download-artifact@v4
with:
name: maven-dist
path: target/
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Run build script
run: sudo PBH_VERSION=${{ env.PBH_VERSION }} IMAGE=${{ env.IMAGE }} bash pkg/synopkg/build-script.sh
env:
PBH_VERSION: ${{ steps.java_info.outputs.project_version }}
IMAGE: ghostchu/peerbanhelper-snapshot:sha-${{ env.COMMIT_SHORT_SHA }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: spk-dist
path: |
/toolkit/build_env/ds.apollolake-7.2/image/packages/*.spk
40 changes: 3 additions & 37 deletions .github/workflows/jvm-ci-pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 注意!!
# 此 PR 禁止使用包含敏感数据或者发布型的操作,避免恶意用户通过 PR 对供应链发起攻击

name: Java CI
name: Java CI (pull_request)

on:
pull_request:
Expand All @@ -19,8 +19,6 @@ jobs:
with:
name: webui-dist
path: src/main/resources/static
- name: Display structure of WebUI dist
run: ls src/main/resources/static
- uses: actions/setup-java@v4
with:
distribution: "temurin"
Expand All @@ -32,39 +30,7 @@ jobs:
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: PullRequest-Artifact-${{ github.sha }}
name: maven-dist
path: |
target/*.jar
target/peerbanhelper-binary
target/media/*.exe
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
- name: Set Up Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ghostchu/peerbanhelper-snapshot
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,ci-jvm-universal
type=raw,ci
type=sha
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile-CI
push: false
platforms: |
linux/amd64
linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}-jvm-universal
cache-from: type=gha
cache-to: type=gha,mode=max
target/media/*.exe
125 changes: 56 additions & 69 deletions .github/workflows/jvm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,80 +6,67 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI
name: Java CI (push)

on:
push:
workflow_dispatch:
jobs:
WebUI:
uses: ./.github/workflows/build_fe.yml
CI:
needs: WebUI
uses: ./.github/workflows/build_maven.yml
secrets: inherit
Build_Installers:
needs: CI
uses: ./.github/workflows/build_installers.yml
secrets: inherit
Build_SPK:
needs: CI
uses: ./.github/workflows/build_spk.yml
Build_DEB:
needs: CI
uses: ./.github/workflows/build_deb.yml
Build_Docker:
needs: CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: webui-dist
path: src/main/resources/static
- name: Display structure of WebUI dist
run: ls src/main/resources/static
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: 'maven'
cache-dependency-path: '**/pom.xml'
- uses: luangong/setup-install4j@v1
name: Setup Install4j
with:
version: 10.0.8
license: ${{ secrets.INSTALL4J_LICENSE }}
- name: Build with Maven
run: mvn -B clean package --file pom.xml -P install4j-ci,thin-sqlite-packaging
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: Artifact-${{ github.sha }}
path: |
target/*.jar
target/peerbanhelper-binary
target/media/*.exe
id: project
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
- name: Set Up Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ghostchu/peerbanhelper-snapshot
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,ci-jvm-universal
type=raw,ci
type=sha
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile-CI
push: true
platforms: |
linux/amd64
linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}-jvm-universal
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: maven-dist
path: target
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
- name: Set Up Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ghostchu/peerbanhelper-snapshot
tags: |
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,ci-jvm-universal
type=raw,ci
type=sha
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile-CI
push: true
platforms: |
linux/amd64
linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}-jvm-universal
cache-from: type=gha
cache-to: type=gha,mode=max
Loading

0 comments on commit 4b7db22

Please sign in to comment.