fix(workflows): missing publishing task on release #50
Workflow file for this run
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 | |
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 | |
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 | |
- name: Save tag prefix to github env | |
id: module | |
run: | | |
echo "module_name=$(echo $GITHUB_REF_NAME | cut -d'/' -f1)" >> $GITHUB_OUTPUT | |
- uses: gradle/gradle-build-action@v2 | |
- name: remove SNAPSHOT on gradle.properties version | |
run: | | |
cd ${{ steps.module.outputs.module_name }} | |
sed -i '/^VERSION=/ s/-SNAPSHOT//' gradle.properties | |
- name: Get version from gradle.properties | |
id: version_name | |
shell: bash | |
run: | | |
cd ${{ steps.module.outputs.module_name }} | |
echo "version=$(grep '^VERSION=' gradle.properties | cut -d'=' -f2)" >> $GITHUB_OUTPUT | |
- name: Gradle build | |
run: ./gradlew ${{ steps.module.outputs.module_name }}:clean ${{ steps.module.outputs.module_name }}:build --scan | |
- name: Publish ${{ steps.module.outputs.module_name }} on GPR | |
run: ./gradlew ${{ steps.module.outputs.module_name }}:publishAllPublicationsToGitHubPackagesRepository | |
- name: Publish ${{ steps.module.outputs.module_name }} on Sonatype | |
run: ./gradlew ${{ steps.module.outputs.module_name }}:publishToSonatype closeSonatypeStagingRepository | |
env: | |
SONATYPE_USER: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASS: ${{ secrets.SONATYPE_PASSWORD }} | |
- name: Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
validation_level: warn | |
version: ${{ steps.version_name.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: aes-${{ steps.changelog_reader.outputs.version }} | |
name: ${{ steps.module.outputs.module_name }} ${{ 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/* | |
docs: | |
needs: [publish] | |
uses: ./.github/workflows/docs.yml | |
with: | |
project: ${{ needs.publish.module.outputs.module_name }} | |
secrets: inherit |