I'm using a Spring Boot app with Gradle as build tool on GitHub repo and I'm going to publish the release version already packaged on GitHub Packages to be ready to deploy in the cloud.
The workflow has been made with GitHub Actions and I have already been able to publish the package on the GitHub Packages.
My requirements are:
I'd like to avoid publishing the assets of the package with timestamp as following image:
but I'd like to have in the standard format like this example
Once that the specific release is done (e.g 1.0.0) and the related package is published on GitHub Packages, I want to avoid overwriting the package or appending the assets to the package.
In a nutshell I want to avoid to create another package version if it is already present.
GitHub Actions workflow:
name: Publish-package-on-GitHub-packages
on:
workflow_dispatch:
inputs:
environment:
description: Target environment
required: true
type: environment
default: dev
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: packaging workflow
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Make gradlew executable
run: |
chmod +x ./gradlew
- name : Get App Version
id: get-app-version
run: |
echo "APP_VERSION_NAME=$(${{github.workspace}}/gradlew -q printAppVersionName)" >> "$GITHUB_ENV"
- name: Print App version
id: print-app-version
run: |
echo "app version: ${{env.APP_VERSION_NAME}}"
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.5
arguments: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build.gradle:
plugins {
id 'maven-publish'
id 'java'
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
}
ext {
group = 'com.xx'
name = 'app_name'
version = '0.1.0-feature_name-SNAPSHOT'
}
java {
sourceCompatibility = '17'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter:3.2.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
task printAppVersionName {
doLast {
println project.ext.version
}
}
tasks.named('test') {
useJUnitPlatform()
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/org_name/repo_name"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
artifact bootJar
groupId = project.ext.group
artifactId = project.ext.name
version = project.ext.version
}
}
}
Can you give me any suggestions to get my requirements ?

Trying to set the version app with semver standard I have satisfied my first requirement. I suppose that the GitHub Packages is only thought to publish the release packages.
eg 0.3.0 version as showed in the image below
In addition I have satisfied my second requirement, because after the first publish package if I run againg the workflow with the same release version I get
I say that the behavior is correct following the best practice