Skip to content

Build with gradle #593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true
type: string

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Cancel previous run
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GIT_ACCESS_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'

- name: Cache Gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Cache Gradle wrapper
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }}
restore-keys: ${{ runner.os }}-gradlew-

- name: Set up Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"

- name: Bump version in gradle.properties
id: bump
run: |
sed -i "s/^version\s*=.*/version = ${{ inputs.version }}/" gradle.properties
git add gradle.properties
git commit --allow-empty -m "Releasing version ${{ inputs.version }}"
git push origin HEAD

- name: Build
run: |
./gradlew build test aggregateTestReport publish -S
env:
GRGIT_USER: ${{ secrets.GIT_USER }}
GRGIT_PASS: ${{ secrets.GIT_ACCESS_TOKEN }}

- name: Upload test reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: |
build/reports/tests/aggregate/

- name: Assemble
uses: jreleaser/release-action@v2
with:
arguments: assemble
env:
JRELEASER_PROJECT_VERSION: ${{ inputs.version }}

- name: Release
uses: jreleaser/release-action@v2
with:
arguments: full-release
env:
JRELEASER_GITHUB_PASSWORD: ${{ secrets.GIT_ACCESS_TOKEN }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
JRELEASER_GITHUB_USERNAME: ${{ secrets.GIT_USER }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
JRELEASER_PROJECT_VERSION: ${{ inputs.version }}
JRELEASER_SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

- name: JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
name: artifact
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties