Skip to content

Github release with autom. generated changelog #502

Github release with autom. generated changelog

Github release with autom. generated changelog #502

Workflow file for this run

name: CI/CD
on: [push, pull_request]
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dkotlin.compiler.execution.strategy=in-process
jobs:
build:
runs-on: ubuntu-latest
outputs:
is_snapshot: ${{ steps.setup.outputs.is_snapshot }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Gradle Cache
uses: gradle/gradle-build-action@v2
- name: Validate Gradle integrity
uses: gradle/wrapper-validation-action@v1
- name: Setup environment
id: setup
run: |
if grep -qi "snapshot" version.txt; then is_snapshot=true; else is_snapshot=false; fi
echo "is_snapshot=$is_snapshot" >> "$GITHUB_OUTPUT"
- name: Build project
run: |
./gradlew assemble publishToMavenLocal -S
cd testapp && ./gradlew help -PskipValidation -S
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Gradle Cache
uses: gradle/gradle-build-action@v2
- name: Setup environment
run: ./gradlew publishToMavenLocal
- name: Run tests
run: ./gradlew check test -S
deploy_snapshot:
needs: [build, test]
runs-on: ubuntu-latest
if: github.repository == 'Triple-T/gradle-play-publisher' && github.ref == 'refs/heads/master' && needs.build.outputs.is_snapshot == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Gradle Cache
uses: gradle/gradle-build-action@v2
- name: Build project
run: ./gradlew assemble
- name: Publish snapshot
run: ./gradlew publishToSonatype
env:
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
deploy_release:
needs: [build, test]
runs-on: ubuntu-latest
if: github.repository == 'Triple-T/gradle-play-publisher' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Gradle Cache
uses: gradle/gradle-build-action@v2
- name: Build project
run: ./gradlew assemble
- name: Publish release
run: |
./gradlew publishToSonatype closeAndReleaseStagingRepository
./gradlew publishPlugins \
-Pgradle.publish.key=$PUBLISH_KEY -Pgradle.publish.secret=$PUBLISH_SECRET
env:
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
PUBLISH_SECRET: ${{ secrets.PUBLISH_SECRET }}
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
- name: Get the version
id: tagger
uses: jimschubert/query-tag-action@v2
with:
skip-unshallow: 'true'
abbrev: false
commit-ish: HEAD
- name: Check pre-release
run: |
echo "tag=${{steps.tagger.outputs.tag}}"
if [[ ${{ steps.tagger.outputs.tag }} == *alpha* || ${{ steps.tagger.outputs.tag }} == *beta* ]]
then
prerelease=true
else
prerelease=false
fi
echo "PRE_RELEASE=$prerelease" >> $GITHUB_ENV
echo "prerelease=$prerelease"
- name: Create Github release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{steps.tagger.outputs.tag}}
name: ${{steps.tagger.outputs.tag}}
generate_release_notes: true
prerelease: ${{ env.PRE_RELEASE }}
body: ${{steps.github_release.outputs.changelog}}
files: play/plugin/build/libs/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}