-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4eeb342
commit b483630
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Build Halo Fat Jar | ||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '30 15 * * *' | ||
- cron: '30 5 * * *' | ||
jobs: | ||
halo: | ||
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/Lu7fer/Jar4Halo/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: gen resources | ||
if: ${{ steps.check.outputs.check != 0 }} | ||
run: | | ||
cd console | ||
npm install -g pnpm | ||
pnpm install --no-frozen-lockfile | ||
pnpm build:packages | ||
pnpm build | ||
# - name: Read value from Properties-file | ||
# id: property | ||
# uses: christian-draeger/read-properties@1.1.0 | ||
# with: | ||
# path: './halo/gradle.properties' | ||
# properties: 'version' | ||
- name: build | ||
if: ${{ steps.check.outputs.check != 0 }} | ||
run: | | ||
./gradlew clean build -x check | ||
ls -lah application/build/libs | ||
- 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/application-${{ steps.ver.outputs.version }}.jar |