Create main.yml #1
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 Jar | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
push: | |
branches: [ "remapped" ] | |
pull_request: | |
branches: [ "remapped" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@v3 | |
- name: Grant execute permission to gradlew | |
run: chmod +x ./gradlew | |
- name: Build Jar | |
run: | | |
./gradlew build | |
mkdir -p ${{ github.workspace }}/artifacts | |
mv build/libs/*.jar ${{ github.workspace }}/artifacts/ | |
- name: Set version as environment variable | |
run: | | |
RELEASE_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}') | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Use Version Number | |
run: | | |
echo "Version number is ${{ env.RELEASE_VERSION }}" | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ env.RELEASE_VERSION }}" | |
prerelease: false | |
title: "Release ${{ env.RELEASE_VERSION }}" | |
files: | | |
${{ github.workspace }}/artifacts/*.jar | |
- name: DONE!!! | |
run: echo "done" |