Skip to content

Gradle Release

Gradle Release #20

# This workflow will build a package using Gradle
# and then create a GitHub release
# and finally upload the asset for download
name: Gradle Release
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: test jar
- name: Set version number env
run: echo "GITHUB_BUILDVERSION=$(cat build.gradle | grep 'version =' | cut -d"'" -f 2)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.GITHUB_BUILDVERSION }}
release_name: Java IP Codec Suite v${{ env.GITHUB_BUILDVERSION }}
draft: false
prerelease: false
- name: Upload Release Asset
id: 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/jipcs-${{ env.GITHUB_BUILDVERSION }}.jar
asset_name: jipcs-${{ env.GITHUB_BUILDVERSION }}.jar
asset_content_type: application/java-archive