Skip to content

Collect and add commit messages to a published artifacts #13

Collect and add commit messages to a published artifacts

Collect and add commit messages to a published artifacts #13

name: Nightly Build and Publish
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
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@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
env:
GITHUB_USERNAME: ${{ github.actor }}
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: |

Check failure on line 36 in .github/workflows/nightly-publish.yml

View workflow run for this annotation

GitHub Actions / Nightly Build and Publish

Invalid workflow file

The workflow is not valid. .github/workflows/nightly-publish.yml (Line: 36, Col: 12): Unrecognized named-value: 'commit_messages'. Located at position 1 within expression: commit_messages
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
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publishAllPublicationsToGitHubPackagesRepository
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_number }}
- name: Delete packages, keep most recent
uses: actions/delete-package-versions@v4
with:
package-name: 'org.minefortress.minefortress-nightly'
package-type: 'maven'
min-versions-to-keep: 10
cleanup-old-packages:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Delete packages, keep most recent
uses: actions/delete-package-versions@v4
with:
package-name: 'org.minefortress.minefortress-nightly'
package-type: 'maven'
min-versions-to-keep: 10