Skip to content

Commit

Permalink
chore(sematic-release): Set up semantic-release with Gradle (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion authored Sep 15, 2022
1 parent 7624281 commit d486776
Show file tree
Hide file tree
Showing 10 changed files with 5,803 additions and 76 deletions.
53 changes: 32 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,34 @@ commands:
- ~/jdk/<<parameters.version>>.tar.gz
key: v1-<<parameters.version>>-{{ checksum "~/jdk/<<parameters.version>>.sha256" }}

install-nodejs:
description: Install NodeJS and Yarn dependencies

steps:
- run:
name: Install NodeJS
command: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --install' >> $BASH_ENV
source $BASH_ENV
- run:
name: Install yarn
command: npm install -g yarn

- restore_cache:
keys:
- yarn-v1-{{ checksum "yarn.lock" }}

- run:
name: Install packages
command: yarn install --immutable

- save_cache:
paths:
- ~/repos/atomic-flyway/.yarn/cache
key: yarn-v1-{{ checksum "yarn.lock" }}

setup:
description: "Setup the environment to run tasks on CI"

Expand Down Expand Up @@ -120,43 +148,26 @@ jobs:
name: Upload reports
command: bash <(curl -s https://codecov.io/bash)

publish-snapshot:
publish:
executor: default

steps:
- install-jdk

- setup

- run:
name: Publish to Sonatype Snapshot OSSRH
command: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository

publish-release:
executor: default

steps:
- install-jdk

- setup
- install-nodejs

- run:
name: Publish to Maven Central
command: ./gradlew -PreleaseVersion publishToSonatype closeAndReleaseSonatypeStagingRepository
command: yarn release

workflows:
main:
jobs:
- build

- publish-snapshot:
requires:
- build
filters:
branches:
only: main

- publish-release:
- publish:
requires:
- build
filters:
Expand Down
99 changes: 54 additions & 45 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,45 +1,54 @@
# Compiled class file
bin/
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# Eclipse
.settings/
.classpath
.project

# VSCode
.vscode

# IDEA
.idea
*.iml

# Gradle Wrapper
!gradle/wrapper/gradle-wrapper.jar
# Compiled class file
bin/
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# Eclipse
.settings/
.classpath
.project

# VSCode
.vscode

# IDEA
.idea
*.iml

# Gradle Wrapper
!gradle/wrapper/gradle-wrapper.jar

# NodeJS
node_modules/
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.9.0
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

783 changes: 783 additions & 0 deletions .yarn/releases/yarn-3.2.3.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.3.cjs
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ plugins {
id 'se.solrike.sonarlint' version '1.0.0-beta.5'
}

def isRelease = project.hasProperty('releaseVersion')
def suffix = isRelease ? '' : '-SNAPSHOT'

group = 'io.github.joselion'
version = "3.0.0$suffix"

java {
toolchain {
Expand Down
14 changes: 8 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
signing.keyId=031E46E1
signing.password={SIGNING_PASSWORD}
signing.secretKeyRingFile=lion-keyring.asc

sonatypeUsername={SONATYPE_USERNAME_TOKEN}
sonatypePassword={SONATYPE_PASSWORD_TOKEN}
version=0.0.0

signing.keyId=031E46E1
signing.password={SIGNING_PASSWORD}
signing.secretKeyRingFile=lion-keyring.asc

sonatypeUsername={SONATYPE_USERNAME_TOKEN}
sonatypePassword={SONATYPE_PASSWORD_TOKEN}
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "maybe",
"version": "0.0.0",
"description": "Maybe release workflow",
"repository": "[email protected]:JoseLion/maybe.git",
"author": "JoseLion <[email protected]>",
"license": "MIT",
"scripts": {
"release": "semantic-release"
},
"devDependencies": {
"gradle-semantic-release-plugin": "^1.7.3",
"semantic-release": "^19.0.5"
},
"packageManager": "[email protected]",
"release": {
"branches": [
"release"
],
"plugins": [
"gradle-semantic-release-plugin"
]
}
}
Loading

0 comments on commit d486776

Please sign in to comment.