Build Halo Jar #697
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Halo Jar | |
on: | |
push: | |
branches: | |
- Build | |
schedule: | |
- cron: '30 15 * * *' | |
- cron: '30 5 * * *' | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
jobs: | |
halo-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: halo-dev/halo | |
fetch-depth: '0' | |
fetch-tags: 'true' | |
- name: 'Get Previous tag' | |
id: tag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
prefix: 'v' | |
- name: check release | |
id: check | |
run: | | |
echo ${{ steps.tag.outputs.tag }} | |
VAR=$(echo "${{ steps.tag.outputs.tag }}" | sed 's/v//') | |
echo $VAR | |
RELEASES=$(curl -s "https://api.github.com/repos/V-Official-233/halo-PaaS/releases/tags/${{ steps.tag.outputs.tag }}") | |
if echo "$RELEASES" | jq '.assets[].name' | grep -q "$VAR"; then | |
echo "check=0" >> $GITHUB_OUTPUT | |
else | |
echo "check=1" >> $GITHUB_OUTPUT | |
if curl -s "https://api.github.com/repos/halo-dev/halo/releases/tags/${{ steps.tag.outputs.tag }}" | jq '.prerelease' | grep -q "true"; then | |
echo "prerelease=true" >> $GITHUB_OUTPUT | |
else | |
echo "prerelease=false" >> $GITHUB_OUTPUT | |
fi | |
fi | |
- name: print var | |
run: | | |
echo check=${{ steps.check.outputs.check }} | |
echo tag=${{ steps.tag.outputs.tag }} | |
- uses: actions/checkout@v4 | |
if: ${{ steps.check.outputs.check != 0 }} | |
with: | |
repository: halo-dev/halo | |
ref: ${{ steps.tag.outputs.tag }} | |
- name: set version | |
id: ver | |
if: ${{ steps.check.outputs.check != 0 }} | |
run: | | |
echo "version=${{ steps.tag.outputs.tag }}" | sed 's/=v/=/' > gradle.properties | |
cat gradle.properties >> $GITHUB_OUTPUT | |
cat gradle.properties | |
curl -s "https://api.github.com/repos/halo-dev/halo/releases/tags/${{ steps.tag.outputs.tag }}" | jq -r '.body' > body.txt | |
- uses: actions/setup-java@v3 | |
if: ${{ steps.check.outputs.check != 0 }} | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
if: ${{ steps.check.outputs.check != 0 }} | |
# - name: Read value from Properties-file | |
# id: property | |
# uses: christian-draeger/[email protected] | |
# with: | |
# path: './halo/gradle.properties' | |
# properties: 'version' | |
- name: Build | |
if: ${{ steps.check.outputs.check != 0 }} | |
run: | | |
npm install -g pnpm | |
./gradlew downloadPluginPresets | |
./gradlew clean build -x check | |
cd application/build/libs/ && mv halo-${{ steps.ver.outputs.version }}.jar halo.jar | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ steps.check.outputs.check != 0 }} | |
with: | |
body_path: body.txt | |
prerelease: ${{ steps.check.outputs.prerelease }} | |
name: ${{ steps.ver.outputs.version }} | |
tag_name: ${{ steps.tag.outputs.tag }} | |
token: ${{ secrets.TOKEN }} | |
files: application/build/libs/halo.jar |