Merge remote-tracking branch 'main/main' #7
Workflow file for this run
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 and Release | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Build with Gradle | |
run: ./gradlew shadowJar | |
- name: Extract version from build.gradle | |
id: extract_version | |
run: | | |
VERSION=$(grep '^version ' build.gradle | awk '{print $3}' | tr -d "'") | |
echo "Extracted version is $VERSION" | |
echo "::set-output name=version::$VERSION" | |
- name: Check if Tag Exists | |
id: check_tag | |
run: | | |
if git rev-parse "v${{ steps.extract_version.outputs.version }}" >/dev/null 2>&1; then | |
echo "::set-output name=exists::true" | |
else | |
echo "::set-output name=exists::false" | |
fi | |
- name: Create Tag | |
# You may pin to the exact commit or the version. | |
# uses: negz/create-tag@39bae1e0932567a58c20dea5a1a0d18358503320 | |
uses: negz/create-tag@v1 | |
if: steps.check_tag.outputs.exists == 'false' | |
continue-on-error: true | |
with: | |
token: ${{secrets.TEST}} | |
version: "v${{ steps.extract_version.outputs.version }}" | |
message: "" | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{secrets.TEST}} | |
tag_name: "v${{ steps.extract_version.outputs.version }}" | |
name: "Release v${{ steps.extract_version.outputs.version }}" | |
files: build/libs/*.jar |