Skip to content

Build and Release

Build and Release #30

Workflow file for this run

name: Build and Release
on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
workflow_dispatch:
inputs:
release_description:
description: "Description for the release"
required: true
default: "No description provided."
release_version:
description: "Version"
required: true
default: "<No version provided.>"
jobs:
publish-artifact:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582
- name: Build with Gradle Wrapper
run: chmod +x gradlew && ./gradlew build
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: gradle-output
path: build/libs/
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: manual-release-${{ github.run_id }}
release_name: "Release v${{ github.event.inputs.release_version }}"
body: ${{ github.event.inputs.release_description }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload All JAR Files
run: |
for file in build/libs/*.jar; do
echo "Uploading $file"
curl \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/java-archive" \
--data-binary @"$file" \
"${{ steps.create_release.outputs.upload_url }}=$(basename $file)"
done