This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
Rettar runs-on #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release (Github Package Registry) | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'gradle' | |
jobs: | |
release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set release tag | |
run: | | |
COMMIT_COUNT=$(git rev-list --all --count) | |
TAG_NAME="$(echo $GITHUB_SHA | cut -c1-7)" | |
echo "RELEASE_TAG=${COMMIT_COUNT}.${TAG_NAME}-gradle" >> $GITHUB_ENV | |
- name: Set changelog | |
# (Escape newlines see https://github.com/actions/create-release/issues/25) | |
run: | | |
text="$(git --no-pager log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")" | |
text="${text//$'%'/%25}" | |
text="${text//$'\n'/%0A}" | |
text="${text//$'\r'/%0D}" | |
echo "CHANGELOG=$text" >> $GITHUB_ENV | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
cache-encryption-key: ${{ secrets.gradlekey }} | |
dependency-graph: generate-and-submit | |
- name: Deploy artifacts to github maven repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Running release" | |
gradle -Pversion="$RELEASE_TAG" publish | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.RELEASE_TAG }} | |
release_name: ${{ env.RELEASE_TAG }} | |
body: | | |
Changes in this Release | |
${{ env.CHANGELOG }} | |
draft: false | |
prerelease: false |