Skip to content

Commit d4403b8

Browse files
committed
New workflow
1 parent dfa5685 commit d4403b8

3 files changed

Lines changed: 188 additions & 112 deletions

File tree

.github/workflows/boat.yml

Lines changed: 4 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: BOAT
22

3-
on: push
3+
on:
4+
pull_request:
5+
branches:
6+
- main
47

58
jobs:
69
test:
@@ -45,114 +48,3 @@ jobs:
4548
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4649
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4750
run: mvn -B verify sonar:sonar
48-
49-
publish:
50-
if: "!contains(github.event.head_commit.message, '[version bump]') && contains(github.ref, 'release')"
51-
runs-on: ubuntu-latest
52-
needs: [ test, sonar ]
53-
steps:
54-
- name: Checkout project
55-
uses: actions/checkout@v2
56-
57-
- name: Setup Build Cache
58-
uses: actions/cache@v1
59-
with:
60-
path: ~/.m2/repository
61-
key: ${{ runner.os }}-m2
62-
restore-keys: |
63-
${{ runner.os }}-m2
64-
65-
- name: Set up JDK 11
66-
uses: actions/setup-java@v1
67-
with:
68-
java-version: 11
69-
70-
- name: Configure Git user
71-
run: |
72-
git config user.email "actions@github.com"
73-
git config user.name "GitHub Actions"
74-
75-
- name: Get version from POM without SNAPSHOT
76-
run: |
77-
VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n"))
78-
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV
79-
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV
80-
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV
81-
82-
- name: Setup release version
83-
run: |
84-
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH))"
85-
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
86-
87-
- name: Update POM Version
88-
run: |
89-
echo "New version is: $NEW_VERSION"
90-
mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false -B
91-
92-
- name: Build and Publish
93-
uses: samuelmeuli/action-maven-publish@v1
94-
with:
95-
maven_args: "-DskipTests=true"
96-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
97-
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
98-
nexus_username: ${{ secrets.NEXUS_USERNAME }}
99-
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
100-
env:
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
103-
- name: Commit files
104-
run: |
105-
git commit -m "[version bump]" -a
106-
git tag -a release-$NEW_VERSION -m "[version bump]"
107-
108-
- name: Push changes
109-
uses: ad-m/github-push-action@master
110-
with:
111-
github_token: ${{ secrets.GITHUB_TOKEN }}
112-
branch: ${{ github.ref }}
113-
114-
bump:
115-
if: "!contains(github.event.head_commit.message, '[version bump]') && contains(github.ref, 'release')"
116-
runs-on: ubuntu-latest
117-
needs: [ publish ]
118-
steps:
119-
120-
- name: Checkout Main Branch
121-
uses: actions/checkout@v2
122-
with:
123-
ref: main
124-
- name: Setup Build Cache
125-
uses: actions/cache@v1
126-
with:
127-
path: ~/.m2/repository
128-
key: ${{ runner.os }}-m2
129-
restore-keys: |
130-
${{ runner.os }}-m2
131-
- name: Set up JDK 11
132-
uses: actions/setup-java@v1
133-
with:
134-
java-version: 11
135-
- name: Configure Git user
136-
run: |
137-
git config user.email "actions@github.com"
138-
git config user.name "GitHub Actions"
139-
- name: Get version from POM without SNAPSHOT
140-
run: |
141-
VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n"))
142-
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV
143-
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV
144-
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV
145-
- name: Bump And Update POM Version to new Development version
146-
run: |
147-
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH+1))-SNAPSHOT"
148-
echo "New development version is: $NEW_VERSION"
149-
mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false
150-
- name: Commit files
151-
run: |
152-
git commit -m "[version bump] new dev version" -a
153-
154-
- name: Push Development Version to Main Branch
155-
uses: ad-m/github-push-action@master
156-
with:
157-
github_token: ${{ secrets.GITHUB_TOKEN }}
158-
branch: main
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
correct_repository:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: fail on fork
14+
if: github.repository_owner != 'Backbase'
15+
run: exit 1
16+
17+
update_release_draft:
18+
needs: correct_repository
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: release-drafter/release-drafter@v5
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
test:
10+
if: "!contains(github.event.head_commit.message, '[version bump]')"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout project
14+
uses: actions/checkout@v2
15+
- name: Setup Build Cache
16+
uses: actions/cache@v1
17+
with:
18+
path: ~/.m2/repository
19+
key: ${{ runner.os }}-m2
20+
restore-keys: |
21+
${{ runner.os }}-m2
22+
- name: Set up JDK 11
23+
uses: actions/setup-java@v1
24+
with:
25+
java-version: 11
26+
- name: Build & Test
27+
run: mvn -B test
28+
29+
sonar:
30+
if: "!contains(github.event.head_commit.message, '[version bump]')"
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout project
34+
uses: actions/checkout@v2
35+
- name: Setup Build Cache
36+
uses: actions/cache@v1
37+
with:
38+
path: ~/.m2/repository
39+
key: ${{ runner.os }}-m2
40+
restore-keys: |
41+
${{ runner.os }}-m2
42+
- name: Set up JDK 11
43+
uses: actions/setup-java@v1
44+
with:
45+
java-version: 11
46+
- name: Build and Analyze
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
50+
run: mvn -B verify sonar:sonar
51+
52+
publish:
53+
if: "!contains(github.event.head_commit.message, '[version bump]') && contains(github.ref, 'release')"
54+
runs-on: ubuntu-latest
55+
needs: [ test, sonar ]
56+
steps:
57+
- name: Checkout project
58+
uses: actions/checkout@v2
59+
60+
- name: Setup Build Cache
61+
uses: actions/cache@v1
62+
with:
63+
path: ~/.m2/repository
64+
key: ${{ runner.os }}-m2
65+
restore-keys: |
66+
${{ runner.os }}-m2
67+
68+
- name: Set up JDK 11
69+
uses: actions/setup-java@v1
70+
with:
71+
java-version: 11
72+
73+
- name: Configure Git user
74+
run: |
75+
git config user.email "actions@github.com"
76+
git config user.name "GitHub Actions"
77+
78+
- name: Get version from POM without SNAPSHOT
79+
run: |
80+
VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n"))
81+
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV
82+
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV
83+
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV
84+
85+
- name: Setup release version
86+
run: |
87+
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH))"
88+
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
89+
90+
- name: Update POM Version
91+
run: |
92+
echo "New version is: $NEW_VERSION"
93+
mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false -B
94+
95+
- name: Build and Publish
96+
uses: samuelmeuli/action-maven-publish@v1
97+
with:
98+
maven_args: "-DskipTests=true"
99+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
100+
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
101+
nexus_username: ${{ secrets.NEXUS_USERNAME }}
102+
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
106+
- name: Commit files
107+
run: |
108+
git commit -m "[version bump]" -a
109+
git tag -a release-$NEW_VERSION -m "[version bump]"
110+
111+
- name: Push changes
112+
uses: ad-m/github-push-action@master
113+
with:
114+
github_token: ${{ secrets.GITHUB_TOKEN }}
115+
branch: ${{ github.ref }}
116+
117+
bump:
118+
if: "!contains(github.event.head_commit.message, '[version bump]') && contains(github.ref, 'release')"
119+
runs-on: ubuntu-latest
120+
needs: [ publish ]
121+
steps:
122+
123+
- name: Checkout Main Branch
124+
uses: actions/checkout@v2
125+
with:
126+
ref: main
127+
- name: Setup Build Cache
128+
uses: actions/cache@v1
129+
with:
130+
path: ~/.m2/repository
131+
key: ${{ runner.os }}-m2
132+
restore-keys: |
133+
${{ runner.os }}-m2
134+
- name: Set up JDK 11
135+
uses: actions/setup-java@v1
136+
with:
137+
java-version: 11
138+
- name: Configure Git user
139+
run: |
140+
git config user.email "actions@github.com"
141+
git config user.name "GitHub Actions"
142+
- name: Get version from POM without SNAPSHOT
143+
run: |
144+
VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n"))
145+
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV
146+
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV
147+
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV
148+
- name: Bump And Update POM Version to new Development version
149+
run: |
150+
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH+1))-SNAPSHOT"
151+
echo "New development version is: $NEW_VERSION"
152+
mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false
153+
- name: Commit files
154+
run: |
155+
git commit -m "[version bump] new dev version" -a
156+
157+
- name: Push Development Version to Main Branch
158+
uses: ad-m/github-push-action@master
159+
with:
160+
github_token: ${{ secrets.GITHUB_TOKEN }}
161+
branch: main

0 commit comments

Comments
 (0)