Skip to content

workflows(release): record current release on kipher-core #70

workflows(release): record current release on kipher-core

workflows(release): record current release on kipher-core #70

Workflow file for this run

name: release
on:
push:
tags:
- "**"
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=2g"
JDK_VERSION: 19
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
outputs:
module_name: ${{ steps.module.outputs.module_name }}
version: ${{ steps.tag.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.JDK_VERSION }}
distribution: temurin
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
- name: Save tag prefix
id: module
run: echo "module_name=$(echo $GITHUB_REF_NAME | cut -d'/' -f1)" >> $GITHUB_OUTPUT
- name: Save tag version
id: tag
run: echo "version=$(echo $GITHUB_REF_NAME | cut -d'/' -f2)" >> $GITHUB_OUTPUT
# publish-plugin assumes its a snapshot without this
- name: remove SNAPSHOT on root gradle.properties
run: sed -i '/^VERSION=/ s/-SNAPSHOT//' gradle.properties
# this avoids relying on early-version snapshot dependency on kipher-core
- name: remove SNAPSHOT suffix on kipher-core version
if: ${{ steps.module.outputs.module_name }} != "kipher-core"
run: |
cd kipher-core
# remove VERSION from gradle.properties
sed -i '/VERSION/d' gradle.properties
# use CURRENT_RELEASE as VERSION
sed -i "s/CURRENT_RELEASE/VERSION/" gradle.properties
- name: replace version on project gradle.properties
run: |
cd ${{ steps.module.outputs.module_name }}
sed -i "/^VERSION=/ s/=.*/=${{ steps.tag.outputs.version }}/" gradle.properties
- name: Gradle build
run: ./gradlew ${{ steps.module.outputs.module_name }}:clean ${{ steps.module.outputs.module_name }}:build --scan
- name: Publish module on GPR
run: ./gradlew ${{ steps.module.outputs.module_name }}:publishAllPublicationsToGitHubPackagesRepository
- name: Publish module on Sonatype
run: ./gradlew ${{ steps.module.outputs.module_name }}:publishToSonatype
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }}
- name: Close sonatype staging repository
run: ./gradlew findSonatypeStagingRepository closeSonatypeStagingRepository
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }}
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: ${{ steps.tag.outputs.version }}
path: docs/CHANGELOG-${{ steps.module.outputs.module_name }}.md
- name: Create release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag: ${{ steps.module.outputs.module_name }}/${{ steps.changelog_reader.outputs.version }}
name: ${{ steps.module.outputs.module_name }} v${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prerelease' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
allowUpdates: true
artifactErrorsFailBuild: false
artifacts: |
${{ steps.module.outputs.module_name }}/build/libs/*
record:
needs: publish
uses: ./.github/workflows/release-record.yml
with:
project: ${{ needs.publish.outputs.module_name }}
version: ${{ needs.publish.outputs.version }}
secrets: inherit
docs:
needs: publish
uses: ./.github/workflows/docs.yml
with:
project: ${{ needs.publish.outputs.module_name }}
version: ${{ needs.publish.outputs.version }}
secrets: inherit