Skip to content

Oops, fixed test cases related to last commit :P #10

Oops, fixed test cases related to last commit :P

Oops, fixed test cases related to last commit :P #10

Workflow file for this run

name: Build and Release Java Application
on:
push:
tags:
- "release_*" # Trigger on tags with prefix release_
jobs:
build_and_release:
runs-on: ubuntu-latest # Specifies the runner environment
steps:
- name: Checkout code
uses: actions/checkout@v3 # Checks out the repository code under $GITHUB_WORKSPACE
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin" # AdoptOpenJDK builds from Eclipse Foundation
- name: Set execute permissions for Gradle wrapper
run: chmod +x ./gradlew
- name: Set TAG_NAME and JAR_NAME environment variable
run: |
echo "TAG_NAME=${GITHUB_REF#refs/tags/release_}" >> $GITHUB_ENV
echo "JAR_NAME=c3pu-${GITHUB_REF#refs/tags/release_}.jar" >> $GITHUB_ENV
env:
GITHUB_REF: ${{ github.ref }}
- name: Build with Gradle
run: ./gradlew build
- name: Rename JAR File
run: |
echo "Renaming JAR file to ${{ env.JAR_NAME }}"
mv build/libs/c3pu-*.jar build/libs/${{ env.JAR_NAME }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ env.TAG_NAME }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/${{ env.JAR_NAME }}
asset_name: ${{ env.JAR_NAME }}
asset_content_type: application/java-archive