Skip to content

Commit 0f26075

Browse files
committed
feat: initial release via semantic release 🎉
1 parent 38c5e08 commit 0f26075

30 files changed

+11309
-183
lines changed

.github/workflows/auth-keycloak.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/build-docker.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
image-name:
55
required: true
66
type: string
7+
version:
8+
required: true
9+
type: string
710
working-dir:
811
required: true
912
type: string
@@ -32,7 +35,8 @@ jobs:
3235
run: |
3336
docker build \
3437
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest" \
35-
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" .
38+
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)" \
39+
-t "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}" .
3640
- name: 🔑 Login to GitHub Container registry
3741
uses: docker/login-action@v1
3842
with:
@@ -44,3 +48,4 @@ jobs:
4448
run: |
4549
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:latest"
4650
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:$(git rev-parse --short HEAD)"
51+
docker push "ghcr.io/codecentric/habitcentric/${{ inputs.image-name }}:${{ inputs.version }}"

.github/workflows/build-java-service.yaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,28 @@ on:
44
service_name:
55
required: true
66
type: string
7+
version:
8+
required: false
9+
type: string
710
outputs:
8-
artifact-name:
9-
value: ${{ jobs.build.outputs.artifact-name }}
10-
artifact-path:
11-
value: ${{ jobs.build.outputs.artifact-path }}
11+
jar-artifact-name:
12+
value: ${{ jobs.build.outputs.jar-artifact-name }}
13+
jar-artifact-path:
14+
value: ${{ jobs.build.outputs.jar-artifact-path }}
15+
license-artifact-name:
16+
value: ${{ jobs.build.outputs.license-artifact-name }}
17+
license-artifact-path:
18+
value: ${{ jobs.build.outputs.license-artifact-path }}
1219

1320
jobs:
1421
build:
1522
name: 🔨 Build and test service
1623
runs-on: ubuntu-latest
1724
outputs:
18-
artifact-name: ${{ inputs.service_name }}-jar
19-
artifact-path: ./services/${{ inputs.service_name }}/build/libs/
25+
jar-artifact-name: ${{ inputs.service_name }}-jar
26+
jar-artifact-path: ./services/${{ inputs.service_name }}/build/libs/
27+
license-artifact-name: ${{ inputs.service_name }}-license
28+
license-artifact-path: ./services/${{ inputs.service_name }}/build/distributions
2029
steps:
2130
- name: ⬇️ Checkout
2231
uses: actions/checkout@v2
@@ -30,13 +39,18 @@ jobs:
3039
- name: 🏗 Build with Gradle
3140
uses: gradle/gradle-build-action@v2
3241
with:
33-
arguments: build generateLicenseReport
42+
arguments: build -Pversion=${{ inputs.version }} generateLicenseReport
3443
build-root-directory: services/${{ inputs.service_name }}
3544
- name: 📦 Upload JAR
3645
uses: actions/upload-artifact@v2
3746
with:
3847
name: ${{ inputs.service_name }}-jar
3948
path: ./services/${{ inputs.service_name }}/build/libs/${{ inputs.service_name }}-*.jar
49+
- name: 📦 Upload license report
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: ${{ inputs.service_name }}-license
53+
path: ./services/${{ inputs.service_name }}/build/distributions/license-report.zip
4054
- name: 📦 Upload test results
4155
uses: actions/upload-artifact@v2
4256
if: always()

.github/workflows/gateway.yaml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,48 @@ on:
55
branches:
66
- '**'
77
paths:
8+
- .github/workflows/prepare-release.yaml
89
- .github/workflows/build-java-service.yaml
910
- .github/workflows/parse-junit-results.yaml
11+
- .github/workflows/build-docker.yaml
12+
- .github/workflows/release.yaml
1013
- .github/workflows/gateway.yaml
1114
- services/gateway
1215

1316
jobs:
17+
prepare-release:
18+
uses: ./.github/workflows/prepare-release.yaml
19+
with:
20+
working-dir: ./services/gateway
21+
1422
build:
1523
uses: ./.github/workflows/build-java-service.yaml
24+
needs: prepare-release
1625
with:
1726
service_name: gateway
27+
version: ${{ needs.prepare-release.outputs.release-version }}
1828

1929
docker:
2030
uses: ./.github/workflows/build-docker.yaml
21-
needs: build
31+
needs:
32+
- prepare-release
33+
- build
2234
with:
2335
image-name: gateway
2436
working-dir: ./services/gateway
25-
artifact-name: ${{ needs.build.outputs.artifact-name }}
26-
artifact-path: ${{ needs.build.outputs.artifact-path }}
37+
version: ${{ needs.prepare-release.outputs.release-version }}
38+
artifact-name: ${{ needs.build.outputs.jar-artifact-name }}
39+
artifact-path: ${{ needs.build.outputs.jar-artifact-path }}
40+
41+
github-release:
42+
uses: ./.github/workflows/release.yaml
43+
needs:
44+
- prepare-release
45+
- build
46+
- docker
47+
with:
48+
service-name: gateway
49+
version: ${{ needs.prepare-release.outputs.release-version }}
50+
change-notes: ${{ needs.prepare-release.outputs.release-notes }}
51+
license-artifact-name: ${{ needs.build.outputs.license-artifact-name }}
52+
license-artifact-path: ${{ needs.build.outputs.license-artifact-path }}

.github/workflows/habit.yaml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,48 @@ on:
55
branches:
66
- '**'
77
paths:
8+
- .github/workflows/prepare-release.yaml
89
- .github/workflows/build-java-service.yaml
910
- .github/workflows/parse-junit-results.yaml
11+
- .github/workflows/build-docker.yaml
12+
- .github/workflows/release.yaml
1013
- .github/workflows/habit.yaml
1114
- services/habit
1215

1316
jobs:
17+
prepare-release:
18+
uses: ./.github/workflows/prepare-release.yaml
19+
with:
20+
working-dir: ./services/habit
21+
1422
build:
1523
uses: ./.github/workflows/build-java-service.yaml
24+
needs: prepare-release
1625
with:
1726
service_name: habit
27+
version: ${{ needs.prepare-release.outputs.release-version }}
1828

1929
docker:
2030
uses: ./.github/workflows/build-docker.yaml
21-
needs: build
31+
needs:
32+
- prepare-release
33+
- build
2234
with:
2335
image-name: habit
2436
working-dir: ./services/habit
25-
artifact-name: ${{ needs.build.outputs.artifact-name }}
26-
artifact-path: ${{ needs.build.outputs.artifact-path }}
37+
version: ${{ needs.prepare-release.outputs.release-version }}
38+
artifact-name: ${{ needs.build.outputs.jar-artifact-name }}
39+
artifact-path: ${{ needs.build.outputs.jar-artifact-path }}
40+
41+
github-release:
42+
uses: ./.github/workflows/release.yaml
43+
needs:
44+
- prepare-release
45+
- build
46+
- docker
47+
with:
48+
service-name: habit
49+
version: ${{ needs.prepare-release.outputs.release-version }}
50+
change-notes: ${{ needs.prepare-release.outputs.release-notes }}
51+
license-artifact-name: ${{ needs.build.outputs.license-artifact-name }}
52+
license-artifact-path: ${{ needs.build.outputs.license-artifact-path }}

.github/workflows/lpt-locust.yaml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,63 @@ on:
66
- '**'
77
paths:
88
- .github/workflows/lpt-locust.yaml
9+
- .github/workflows/prepare-release.yaml
910
- .github/workflows/build-docker.yaml
11+
- .github/workflows/release.yaml
1012
- test/lpt-locust
1113

1214
jobs:
13-
build:
15+
prepare-release:
16+
uses: ./.github/workflows/prepare-release.yaml
17+
with:
18+
working-dir: ./test/lpt-locust
19+
20+
license-report:
21+
name: 📋 Generate license report
22+
runs-on: ubuntu-latest
23+
outputs:
24+
license-artifact-name: license-report
25+
license-artifact-path: ./test/lpt-locust/license-report
26+
steps:
27+
- name: ⬇️ Checkout
28+
uses: actions/checkout@v2
29+
- name: 🏗 Setup python
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.9'
33+
cache: 'pip'
34+
cache-dependency-path: 'test/lpt-locust/requirements.txt'
35+
- name: 👨🏻‍💻 Install dependencies
36+
run: pip install -r test/lpt-locust/requirements.txt
37+
- name: 📋 Generate license report
38+
working-directory: ./test/lpt-locust
39+
run: |
40+
pip-licenses --with-license-file \
41+
--format html --with-notice-file --no-license-path >licenses.html
42+
- name: 📦 Upload license report
43+
uses: actions/upload-artifact@v2
44+
with:
45+
name: license-report
46+
path: ./test/lpt-locust/licenses.html
47+
48+
docker:
1449
uses: ./.github/workflows/build-docker.yaml
50+
needs:
51+
- prepare-release
1552
with:
1653
image-name: lpt-locust
1754
working-dir: ./test/lpt-locust
55+
version: ${{ needs.prepare-release.outputs.release-version }}
56+
57+
github-release:
58+
uses: ./.github/workflows/release.yaml
59+
needs:
60+
- prepare-release
61+
- license-report
62+
- docker
63+
with:
64+
service-name: lpt-locust
65+
version: ${{ needs.prepare-release.outputs.release-version }}
66+
change-notes: ${{ needs.prepare-release.outputs.release-notes }}
67+
license-artifact-name: ${{ needs.license-report.outputs.license-artifact-name }}
68+
license-artifact-path: ${{ needs.license-report.outputs.license-artifact-path }}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
working-dir:
5+
required: true
6+
type: string
7+
outputs:
8+
release-version:
9+
value: ${{ jobs.prepare-release.outputs.version }}
10+
release-notes:
11+
value: ${{ jobs.prepare-release.outputs.notes }}
12+
13+
jobs:
14+
prepare-release:
15+
name: 🛫 Prepare release
16+
runs-on: ubuntu-latest
17+
outputs:
18+
version: ${{ steps.prepare-release.outputs.version }}
19+
notes: ${{ steps.prepare-release.outputs.notes }}
20+
steps:
21+
- name: ⬇️ Checkout
22+
uses: actions/checkout@v2
23+
- name: 🏗 Setup node env
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: lts/*
27+
cache-dependency-path: package-lock.json
28+
- name: 👨🏻‍💻 Install dependencies
29+
run: npm install
30+
- name: 🛫 Prepare Release
31+
id: prepare-release
32+
working-directory: ${{ inputs.working-dir }}
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
npx semantic-release-plus
37+
version=$(cat release/version.txt)
38+
notes=$(cat release/notes.md)
39+
notes="${notes//'%'/'%25'}"
40+
notes="${notes//$'\n'/'%0A'}"
41+
notes="${notes//$'\r'/'%0D'}"
42+
echo "::set-output name=version::$version"
43+
echo "::set-output name=notes::$notes"

.github/workflows/release.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
service-name:
5+
required: true
6+
type: string
7+
version:
8+
required: true
9+
type: string
10+
change-notes:
11+
required: true
12+
type: string
13+
license-artifact-name:
14+
required: false
15+
type: string
16+
license-artifact-path:
17+
required: false
18+
type: string
19+
20+
jobs:
21+
release:
22+
name: 🎉 Release
23+
runs-on: ubuntu-latest
24+
if: github.ref == 'refs/heads/main'
25+
steps:
26+
- name: ⬇️ Checkout
27+
uses: actions/checkout@v2
28+
- name: 📦 Download license artifact
29+
uses: actions/download-artifact@v2
30+
with:
31+
name: ${{ inputs.license-artifact-name }}
32+
path: ${{ inputs.license-artifact-path }}
33+
- name: 🏷 Tag repository
34+
uses: actions/github-script@v5
35+
with:
36+
script: |
37+
github.rest.git.createRef({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
ref: 'refs/tags/${{ inputs.service-name }}-v${{ inputs.version }}',
41+
sha: context.sha
42+
})
43+
- name: 🚀 Release
44+
uses: softprops/action-gh-release@v1
45+
with:
46+
body: ${{ inputs.change-notes }}
47+
fail_on_unmatched_files: false
48+
files: ${{ inputs.license-artifact-path }}/*
49+
tag_name: ${{ inputs.service-name }}-v${{ inputs.version }}

0 commit comments

Comments
 (0)