Skip to content

Commit 96a0516

Browse files
committed
Added release workflow
1 parent 971f184 commit 96a0516

File tree

5 files changed

+106
-7
lines changed

5 files changed

+106
-7
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
name: Build
22

33
on:
4-
push
4+
push:
5+
branches:
6+
- '**'
7+
paths-ignore:
8+
- '.github/workflows/publish.yml'
9+
- '.github/workflows/release.yml'
10+
- 'example/**'
11+
- '.gitignore'
12+
- 'LICENSE'
13+
- 'README.md'
14+
pull_request:
15+
branches:
16+
- '**'
17+
paths-ignore:
18+
- '.github/workflows/publish.yml'
19+
- '.github/workflows/release.yml'
20+
- 'example/**'
21+
- '.gitignore'
22+
- 'LICENSE'
23+
- 'README.md'
524

625
jobs:
726
build:
27+
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
828
runs-on: ubuntu-latest
929
steps:
1030

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
uses: actions/setup-java@v1
1717
with:
1818
java-version: 11
19-
server-id: ossrh
20-
server-username: MAVEN_USERNAME
21-
server-password: MAVEN_PASSWORD
19+
server-id: ossrh
20+
server-username: MAVEN_USERNAME
21+
server-password: MAVEN_PASSWORD
2222

2323
- name: Cache
2424
uses: actions/cache@v2

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
description: 'Release version if different than actual without SNAPSHOT'
8+
default: ''
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Java
19+
uses: actions/setup-java@v1
20+
with:
21+
java-version: 11
22+
23+
- name: Cache
24+
uses: actions/cache@v2
25+
with:
26+
path: ~/.m2/repository
27+
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
28+
restore-keys: |
29+
${{ runner.os }}-maven-
30+
31+
- name: Set up Git
32+
run: |
33+
git config --global user.name "jsonschema2pojo-spring-data-couchbase"
34+
git config --global user.email "jsonschema2pojo-spring-data-couchbase@hectorbst.github.io"
35+
36+
- name: Update version
37+
if: "github.event.inputs.releaseVersion != ''"
38+
run: |
39+
# Update development version if needed and commit
40+
echo "New development version is ${{ github.event.inputs.releaseVersion }}-SNAPSHOT"
41+
mvn -B versions:set -DnewVersion=${{ github.event.inputs.releaseVersion }}-SNAPSHOT
42+
git commit pom.xml -m "Updated development version to ${{ github.event.inputs.releaseVersion }}-SNAPSHOT"
43+
44+
- name: Tag version
45+
id: tag-version
46+
run: |
47+
# Get current development version
48+
CURRENT_DEV_VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
49+
echo "Current development version is $CURRENT_DEV_VERSION"
50+
# Get release version
51+
RELEASE_VERSION=${CURRENT_DEV_VERSION%-SNAPSHOT}
52+
echo "Release version is $RELEASE_VERSION"
53+
# Update with release version, commit and push
54+
mvn -B versions:set -DnewVersion="${RELEASE_VERSION}"
55+
git commit pom.xml -m "Release ${RELEASE_VERSION}"
56+
git push
57+
# Tag and push
58+
git tag -a v$RELEASE_VERSION -m v$RELEASE_VERSION
59+
git push --follow-tags
60+
echo "::set-output name=releaseVersion::${RELEASE_VERSION}"
61+
echo "::set-output name=tagName::v${RELEASE_VERSION}"
62+
63+
- name: Create release
64+
uses: actions/create-release@v1
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.PAT }}
67+
with:
68+
tag_name: ${{ steps.tag-version.outputs.tagName }}
69+
release_name: ${{ steps.tag-version.outputs.releaseVersion }}
70+
draft: false
71+
prerelease: false
72+
73+
- name: Increment version
74+
run: |
75+
# Increment to next development version, get it, commit and push
76+
mvn -B org.apache.maven.plugins:maven-release-plugin:update-versions
77+
NEXT_DEV_VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
78+
echo "Next development is $NEXT_DEV_VERSION"
79+
git commit pom.xml -m "Started version ${NEXT_DEV_VERSION}"
80+
git push

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![Coverage](https://img.shields.io/sonar/coverage/HectorBst_jsonschema2pojo-spring-data-couchbase?server=https%3A%2F%2Fsonarcloud.io&label=Coverage)](https://sonarcloud.io/dashboard?id=HectorBst_jsonschema2pojo-spring-data-couchbase)
33
[![Violations](https://img.shields.io/sonar/violations/HectorBst_jsonschema2pojo-spring-data-couchbase?server=https%3A%2F%2Fsonarcloud.io&label=Violations)](https://sonarcloud.io/dashboard?id=HectorBst_jsonschema2pojo-spring-data-couchbase)
44
[![Maven Central](https://img.shields.io/maven-central/v/io.github.hectorbst/jsonschema2pojo-spring-data-couchbase?label=Maven%20Central)](https://search.maven.org/artifact/io.github.hectorbst/jsonschema2pojo-spring-data-couchbase)
5-
[![Licence](https://img.shields.io/github/license/hectorbst/jsonschema2pojo-spring-data-couchbase?label=Licence)](LICENSE)
5+
[![License](https://img.shields.io/github/license/hectorbst/jsonschema2pojo-spring-data-couchbase?label=License)](LICENSE)
66

77
# jsonschema2pojo-spring-data-couchbase
88

pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
43
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
54
<modelVersion>4.0.0</modelVersion>
65

0 commit comments

Comments
 (0)