Skip to content
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

Add semantic-release maven plugin #25

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
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
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build CI

on: [ push ]

jobs:
build:
name: Build CI JDK ${{ matrix.java }}
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
java: [ "8", "16" ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: "adopt"
server-id: github
server-username: PACKAGES_USERNAME
server-password: PACKAGES_PASSWORD

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-build-${{ matrix.java }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Build with Maven
run: mvn -B --update-snapshots package
env:
PACKAGES_USERNAME: $GITHUB_ACTOR
PACKAGES_PASSWORD: ${{ github.token }}
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release CI

on:
push:
branches:
- "main"
- "master"

jobs:
build:
name: Release CI
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK 16
uses: actions/setup-java@v2
with:
java-version: 16
distribution: "adopt"
server-id: github
server-username: PACKAGES_USERNAME
server-password: PACKAGES_PASSWORD

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-release-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

# semantic-release:release will fail, when no release required
- name: Release with Maven
run: mvn -B semantic-release:release
id: release
continue-on-error: true

- name: Sync develop
run: |
git checkout develop
git merge main
git push
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
continue-on-error: true

- name: Switch back to main
run: git checkout main
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
continue-on-error: true

- name: Get current tag
id: current_tag
run: echo ::set-output name=tag::$(git describe --abbrev=0 --tags)
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'

- name: Get Git Changelog
id: get_changelog
uses: thenilsdev/[email protected]
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'

- name: Build with Maven
run: mvn -B package
env:
PACKAGES_USERNAME: $GITHUB_ACTOR
PACKAGES_PASSWORD: ${{ github.token }}
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'

- name: Publish package to github
run: mvn -B deploy
env:
PACKAGES_USERNAME: $GITHUB_ACTOR
PACKAGES_PASSWORD: ${{ github.token }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'

- name: Create Release
uses: softprops/[email protected]
id: create_release
with:
tag_name: ${{ steps.current_tag.outputs.tag }}
name: Release ${{ steps.current_tag.outputs.tag }}
body: ${{ steps.get_changelog.outputs.log }}
files: ./artifacts/*.jar
env:
GITHUB_TOKEN: ${{ github.token }}
if: steps.release.outcome == 'success' && steps.release.conclusion == 'success'
126 changes: 122 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,124 @@
/target/
*.prefs
.project
*.classpath

# Created by https://www.toptal.com/developers/gitignore/api/git,maven,intellij+all
# Edit at https://www.toptal.com/developers/gitignore?templates=git,maven,intellij+all

### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig

# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

# End of https://www.toptal.com/developers/gitignore/api/git,maven,intellij+all

artifacts/
8 changes: 8 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/EXTENSIONS/1.0.0"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>gg.nils</groupId>
<artifactId>semantic-release-maven-plugin</artifactId>
<version>1.1.9</version>
</extension>
</extensions>
Loading