Skip to content

Commit

Permalink
Collect and add commit messages to a published artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
remmintan committed May 21, 2023
1 parent a6eb707 commit 3a6516d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/nightly-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_number }}

- name: Retrieve all commit messages pushed and put in the environment variable GITHUB_COMMITS_TEXT
run: |
commit_messages=$(git log --format=%s ${{ github.sha }}..${{ github.event.before }})
echo "GITHUB_COMMITS_TEXT=${{ commit_messages }}" >> $GITHUB_ENV
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
Expand Down
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY"))
url = uri("https://maven.pkg.github.com/" + (System.getenv("GITHUB_REPOSITORY") ?: "minefortress-mod/minefortress"))
credentials {
username = System.getenv("GITHUB_USERNAME")
password = System.getenv("GITHUB_TOKEN")
Expand All @@ -104,6 +104,9 @@ publishing {
mavenJava(MavenPublication) {
artifactId = project.archivesBaseName
from components.java
pom {
description = System.getenv("GITHUB_COMMITS_TEXT") ?: "No description provided"
}
}
}
}

0 comments on commit 3a6516d

Please sign in to comment.