Skip to content

Commit

Permalink
Add the gradle changelog plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbrooks committed Jul 27, 2024
1 parent f317ff4 commit 456a3dc
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 38 deletions.
53 changes: 52 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ on:

jobs:
build:

runs-on: ubuntu-latest
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}

steps:
- uses: actions/checkout@v4
Expand All @@ -31,6 +33,19 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "::set-output name=version::$VERSION"
echo "::set-output name=changelog::$CHANGELOG"
- name: build
run: ./gradlew build

Expand All @@ -54,3 +69,39 @@ jobs:
with:
name: vgo
path: vgo/build/libs/vgo

# Prepare a draft release for GitHub Releases page for the manual verification
# If accepted and published, release workflow would be triggered
releaseDraft:
name: Release Draft
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4

# Remove old release drafts by using the curl request for the available releases with draft flag
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/{owner}/{repo}/releases \
--jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
# Create new release draft - which is not publicly visible and requires manual acceptance
- name: Create Release Draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ needs.build.outputs.version }} \
--draft \
--title "v${{ needs.build.outputs.version }}" \
--notes "$(cat << 'EOM'
${{ needs.build.outputs.changelog }}
EOM
)"
33 changes: 31 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ jobs:
publish:
name: Release build and publish
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Check out code
- name: Fetch Sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

- name: Set up a JDK
id: setup-jdk
Expand All @@ -34,4 +40,27 @@ jobs:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
SONATYPE_PROFILE_ID: ${{ secrets.SONATYPE_PROFILE_ID }}
run: ./gradlew -Psigning.keyId=${{ secrets.SIGNING_KEY_ID}} -Psigning.password=${{ secrets.SIGNING_KEY_PASSWORD }} -Psigning.secretKeyRingFile=${{ secrets.SIGNING_KEY_FILE_PATH }} --no-configuration-cache publishAndReleaseToMavenCentral
run: ./gradlew -Psigning.keyId=${{ secrets.SIGNING_KEY_ID}} -Psigning.password=${{ secrets.SIGNING_KEY_PASSWORD }} -Psigning.secretKeyRingFile=${{ secrets.SIGNING_KEY_FILE_PATH }} --no-configuration-cache publishAndReleaseToMavenCentral

- name: Patch Changelog
run: |
./gradlew patchChangelog --release-note="`cat << EOM
${{ github.event.release.body }}
EOM`"
- name: Open PR for Changelog Update
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION="${{ github.event.release.tag_name }}"
BRANCH="changelog-update-$VERSION"
git config user.name github-actions
git config user.email [email protected]
git checkout -b $BRANCH
git commit -am "Changelog update - $VERSION"
git push --set-upstream origin $BRANCH
gh pr create \
--title "Changelog update - \`$VERSION\`" \
--body "Current pull request contains patched \`changelog.md\` file for the \`$VERSION\` version." \
--base master \
--head $BRANCH
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.changelog.date
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jlleitschuh.gradle.ktlint.KtlintExtension
Expand All @@ -8,8 +9,11 @@ plugins {
id("org.jetbrains.kotlin.jvm") version "2.0.0"
id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
id("com.vanniktech.maven.publish") version "0.29.0"
id("org.jetbrains.changelog") version "2.2.1"
}

version = property("VERSION_NAME").toString()

subprojects {
apply<KtlintPlugin>()
configure<KtlintExtension> {
Expand Down Expand Up @@ -80,3 +84,8 @@ subprojects {
)
}
}

changelog {
header.set(provider { "${version.get()}\n_${date()}_\n" })
groups.set(listOf("New", "Improvement", "Fix", "Upgrade"))
}
92 changes: 57 additions & 35 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,106 @@
Change Log
==========
# Changelog

## Unreleased

### New
- Use Android Studio conversion tools are used for SVG → vector drawable conversions

### Improvement

### Fix

### Upgrade

## 2.1.0
_09.14.2021_

* New: Simplified optimization machinery with `ElementVisitor`
* Improvement: `MergePaths` no longer requires its own tree traversal
* Improvement: Attribute values omit leading zeros where possible
* Fix: theme referenced colors like `?attrs/dark` no longer cause crashes
* Upgrade: Build tools
_09-14-2021_

- New: Simplified optimization machinery with `ElementVisitor`
- Improvement: `MergePaths` no longer requires its own tree traversal
- Improvement: Attribute values omit leading zeros where possible
- Fix: theme referenced colors like `?attrs/dark` no longer cause crashes
- Upgrade: Build tools

## 2.0.2

_06.02.2021_

* Fixed: Vector Drawable shorthand hex colors (like #FFF) are properly handled
- Fixed: Vector Drawable shorthand hex colors (like #FFF) are properly handled

## 2.0.1

_06.01.2021_

* Fixed: Groups that wrap clip paths are no longer removed
- Fixed: Groups that wrap clip paths are no longer removed

## 2.0.0

_05.29.2021_

* New, breaking(vgo-core): Structured graphic element attributes.
- New, breaking(vgo-core): Structured graphic element attributes.
* This greatly simplifies the conversions between formats
* Unstructured attributes will be dropped during conversion between formats
* Improvement, breaking(vgo): Unified the clip path implementation
* Improvement, breaking(vgo): Format-specific implementations of optimizations have been traded for format independent implementations, so they can be more easily used by new formats
* Improvement: The new implementation of the bake transformations optimization operates in many more situations for svg compared to the previous implementation
* Improvement: Remove redundant commands in situations where the command is effectively but not precisely redundant
* Fixed: Redundant move commands are removed
* Fixed: Test failures on Windows due to path handling
* Upgrade: Build with Kotlin 1.5.10
- Improvement, breaking(vgo): Unified the clip path implementation
- Improvement, breaking(vgo): Format-specific implementations of optimizations have been traded for format independent implementations, so they can be more easily used by new formats
- Improvement: The new implementation of the bake transformations optimization operates in many more situations for svg compared to the previous implementation
- Improvement: Remove redundant commands in situations where the command is effectively but not precisely redundant
- Fixed: Redundant move commands are removed
- Fixed: Test failures on Windows due to path handling
- Upgrade: Build with Kotlin 1.5.10

## 1.4.1

_02.16.2021_

* Added: A new type for the `shrinkVectorArtwork` task
- Added: A new type for the `shrinkVectorArtwork` task

## 1.4.0

_02.15.2021_

* Added: Gradle plugin
* Improved: Reworked the gradle modules to better be published as a library (vgo-core) and thin application wrapper (vgo).
* Added: Sonatype publishing
- Added: Gradle plugin
- Improved: Reworked the gradle modules to better be published as a library (vgo-core) and thin application wrapper (vgo).
- Added: Sonatype publishing

## 1.3.0

_01.18.2021_

* Added: Collapse multiple Bézier curves into elliptical arcs when possible
* Improvement: Target JVM 11
- Added: Collapse multiple Bézier curves into elliptical arcs when possible
- Improvement: Target JVM 11

## 1.2.2

_10.20.2020_

* Improvement: Show filenames with statistics with multiple file inputs and `--stats`
* Improvement: Remove Kotlin metadata from the output jar
* Fixed: Temporarily removed an optimization that distorted some images
- Improvement: Show filenames with statistics with multiple file inputs and `--stats`
- Improvement: Remove Kotlin metadata from the output jar
- Fixed: Temporarily removed an optimization that distorted some images

## 1.2.1

_10.01.2020_

* Fixed: Some images with curves that lie on a circle omit any representation of that circle in the output
* Fixed: Modifying files in-place sometimes results in destroying non-vector files.
- Fixed: Some images with curves that lie on a circle omit any representation of that circle in the output
- Fixed: Modifying files in-place sometimes results in destroying non-vector files.

## 1.2.0

_09.28.2020_

* Improvement: Resort to distribution via a fat jar. Requires managing fewer files and results in a smaller installation since R8 can operate on classes from dependencies as well.
* Improvement: Use R8 for optimization. R8 produces a slightly smaller jar and in some cases faster code as well.
- Improvement: Resort to distribution via a fat jar. Requires managing fewer files and results in a smaller installation since R8 can operate on classes from dependencies as well.
- Improvement: Use R8 for optimization. R8 produces a slightly smaller jar and in some cases faster code as well.

## 1.1.1

_07.13.2020_

* Fixed: A crash when running on a file in the current directory
* Improvement: Report an error when an input file doesn't exist
- Fixed: A crash when running on a file in the current directory
- Improvement: Report an error when an input file doesn't exist

## 1.1.0

_06.20.2020_

* New: Remove redundant close path commands
* Improvement: Use the Gradle Application Plugin to build application distrobutions, simplifying installation and making running the tool a little simpler.
- New: Remove redundant close path commands
- Improvement: Use the Gradle Application Plugin to build application distrobutions, simplifying installation and making running the tool a little simpler.

0 comments on commit 456a3dc

Please sign in to comment.