Skip to content

Commit

Permalink
Adding functionality for making releases to central (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
orchestr7 committed Feb 7, 2024
1 parent 4483a47 commit 8d327e2
Show file tree
Hide file tree
Showing 6 changed files with 365 additions and 63 deletions.
88 changes: 27 additions & 61 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,81 +9,47 @@ env:
GRADLE_OPTS: -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.welcome=never
GPG_SEC: ${{ secrets.PGP_SEC }}
GPG_PASSWORD: ${{ secrets.PGP_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
release:
name: 'Release'
name: Build release
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]

os: [ macos-latest ]
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch Git tags, so that semantic version can be calculated.
# Alternatively, run `git fetch --prune --unshallow --tags` as the
# next step, see
# https://github.com/actions/checkout/issues/206#issuecomment-607496604.
# release workflow should have access to all tags
fetch-depth: 0

- name: 'Set up Java 17'
uses: actions/setup-java@v4
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 17
java-version: 8
distribution: zulu
java-package: jdk+fx

- name: 'Cache ~/.konan'
id: cache-konan
uses: actions/cache@v4
with:
path: |
~/.konan
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}-release
restore-keys: |
${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}-
${{ runner.os }}-konan-
- name: 'Publish a release (Linux)'
id: publish-linux
if: ${{ runner.os == 'Linux' }}
uses: gradle/gradle-build-action@v3
with:
gradle-version: wrapper
arguments: |
build
publishJvmPublicationToGitHubRepository
publishKotlinMultiplatformPublicationToGitHubRepository
publishLinuxX64PublicationToGitHubRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Publish a release (Windows)'
id: publish-windows
if: ${{ runner.os == 'Windows' }}
uses: gradle/gradle-build-action@v3
- name: Status git before
run: git status
- uses: burrunan/gradle-cache-action@v1
with:
gradle-version: wrapper
arguments: |
build
publishMingwX64PublicationToGitHubRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Until https://github.com/burrunan/gradle-cache-action/issues/42 is addressed, gradle should be run as a separate step
- name: gradle release from tag
# if workflow is triggered after push of a tag, deploy full release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: ./gradlew
--console=rich
-Prelease
-PgprUser=${{ github.actor }}
-PgprKey=${{ secrets.GITHUB_TOKEN }}
publishToSonatype
- name: Status git after
if: ${{ always() }}
run: git status

- name: 'Publish a release (Mac OS X)'
id: publish-macosx
if: ${{ runner.os == 'macOS' }}
uses: gradle/gradle-build-action@v3
with:
gradle-version: wrapper
arguments: |
build
publishMacosX64PublicationToGitHubRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

github_release:
needs: release
Expand Down
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ plugins {
`maven-publish`
signing
id("org.jetbrains.dokka") version "1.9.10"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("io.gitlab.arturbosch.detekt")
id("org.cqfn.diktat.diktat-gradle-plugin") version "1.2.5"
id("com.saveourtool.diktat") version "2.0.0"
}

group = "com.saveourtool"
Expand Down
114 changes: 114 additions & 0 deletions diktat-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
- name: DIKTAT_COMMON
enabled: true
configuration:
domainName: com.saveourtool.okio
kotlinVersion: 1.8
srcDirectories: "main,nativeMain,commonNonJsMain"
testDirs: "test,nativeTest,commonTest,jvmTest,commonNonJsTest"
- name: AVOID_NULL_CHECKS
enabled: false
- name: ENUM_VALUE
enabled: true
configuration:
enumStyle: snakeCase
- name: KDOC_CONTAINS_DATE_OR_AUTHOR
enabled: true
configuration:
versionRegex: \d+\.\d+\.\d+[-.\w\d]*
- name: HEADER_MISSING_OR_WRONG_COPYRIGHT
enabled: true
configuration:
isCopyrightMandatory: false
copyrightText: ''
- name: FILE_IS_TOO_LONG
enabled: true
configuration:
maxSize: 450
ignoreFolders: ''
- name: FILE_UNORDERED_IMPORTS
enabled: true
configuration:
useRecommendedImportsOrder: true
- name: FILE_WILDCARD_IMPORTS
enabled: true
configuration:
allowedWildcards: "kotlinx.serialization.*"
- name: BRACES_BLOCK_STRUCTURE_ERROR
enabled: true
configuration:
openBraceNewline: true
closeBraceNewline: true
- name: WRONG_INDENTATION
enabled: true
configuration:
# Is newline at the end of a file needed
newlineAtEnd: true
# If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one
extendedIndentOfParameters: false
# If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it
alignedParameters: true
# If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
extendedIndentAfterOperators: true
# If true: when dot qualified expression starts on a new line, this line will be indented with two indentations instead of one
extendedIndentBeforeDot: false
# The indentation size for each file
indentationSize: 4
extendedIndentForExpressionBodies: true
- name: EMPTY_BLOCK_STRUCTURE_ERROR
enabled: true
configuration:
styleEmptyBlockWithNewline: true
allowEmptyBlocks: false
- name: LONG_LINE
enabled: true
configuration:
lineLength: 180
- name: WRONG_NEWLINES
enabled: true
configuration:
maxParametersInOneLine: 2
- name: TOO_MANY_CONSECUTIVE_SPACES
enabled: true
configuration:
maxSpaces: 1
saveInitialFormattingForEnums: false
- name: LONG_NUMERICAL_VALUES_SEPARATED
enabled: true
configuration:
maxNumberLength: 5
maxBlockLength: 3
- name: WRONG_DECLARATIONS_ORDER
enabled: true
configuration:
sortEnum: true
sortProperty: true
- name: COMMENT_WHITE_SPACE
enabled: true
configuration:
maxSpacesBeforeComment: 2
maxSpacesInComment: 1
- name: TYPE_ALIAS
enabled: true
configuration:
typeReferenceLength: 25
- name: TOO_LONG_FUNCTION
enabled: true
configuration:
maxFunctionLength: 35 # max length of function
isIncludeHeader: false # count function's header
- name: TOO_MANY_PARAMETERS
enabled: true
configuration:
maxParameterListSize: 5
- name: NESTED_BLOCK
enabled: true
configuration:
maxNestedBlockQuantity: 4
- name: TRAILING_COMMA
enabled: false
configuration:
valueArgument: true
valueParameter: true
- name: DEBUG_PRINT
enabled: true
ignoreAnnotated: [ Test ]
14 changes: 14 additions & 0 deletions gradle/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
gradlePluginPortal()
}

dependencies {
implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
}
Loading

0 comments on commit 8d327e2

Please sign in to comment.