forked from github-mirror/CoreProtect
Add .gitea/workflows/autobuild.yml
This commit is contained in:
1 parent
4ae0affe4b
commit
01de586cec
1 file changed
+58
@@ -0,0 +1,58 @@
|
|||||||
|
name: Daily Autobuild
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 3 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build & Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up JDK 25
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '25'
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: 'maven'
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: mvn -B verify
|
||||||
|
|
||||||
|
- name: Get version info
|
||||||
|
id: info
|
||||||
|
run: |
|
||||||
|
echo "date=$(date -u '+%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||||
|
echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
echo "jar=$(ls target/*.jar | head -1)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
run: |
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||||
|
-d '{
|
||||||
|
"tag_name": "autobuild-${{ steps.info.outputs.date }}-${{ steps.info.outputs.sha }}",
|
||||||
|
"name": "Autobuild ${{ steps.info.outputs.date }} (${{ steps.info.outputs.sha }})",
|
||||||
|
"body": "Automated daily build from commit ${{ steps.info.outputs.sha }}.",
|
||||||
|
"prerelease": true,
|
||||||
|
"draft": false
|
||||||
|
}' > release.json
|
||||||
|
echo "release_id=$(jq -r .id release.json)" >> $GITHUB_OUTPUT
|
||||||
|
id: release
|
||||||
|
|
||||||
|
- name: Upload JAR to release
|
||||||
|
run: |
|
||||||
|
JAR="${{ steps.info.outputs.jar }}"
|
||||||
|
FILENAME=$(basename "$JAR")
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/java-archive" \
|
||||||
|
--data-binary @"$JAR" \
|
||||||
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${{ steps.release.outputs.release_id }}/assets?name=$FILENAME"
|
||||||
Reference in new issue
Block a user