-
Notifications
You must be signed in to change notification settings - Fork 70
144 lines (140 loc) · 6.33 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build and Release
on:
push:
tags:
- "[0-9]*.[0-9]*.[0-9]**"
jobs:
build_and_release:
name: 'Build and Release'
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17 # Spring 3 needs at least java 17
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Scan dependencies
run: ./gradlew dependencyCheckAggregate
- name: Build artifacts
run: |
./gradlew assemble bootJarWithFrontend :inspectit-ocelot-core:cyclonedxBom :inspectit-ocelot-configurationserver:cyclonedxBom -PbuildVersion=${{ github.ref_name }}
mkdir artifacts
cp ./inspectit-ocelot-agent/build/inspectit-ocelot-agent-${{ github.ref_name }}.jar ./artifacts
cp ./components/inspectit-ocelot-configurationserver/build/libs/inspectit-ocelot-configurationserver-${{ github.ref_name }}.jar ./artifacts
mkdir boms
cp ./inspectit-ocelot-core/build/reports/bom.json ./boms/inspectit-ocelot-agent-bom.json
cp ./inspectit-ocelot-core/build/reports/bom.xml ./boms/inspectit-ocelot-agent-bom.xml
cp ./components/inspectit-ocelot-configurationserver/build/reports/bom.json ./boms/inspectit-ocelot-configurationserver-bom.json
cp ./components/inspectit-ocelot-configurationserver/build/reports/bom.xml ./boms/inspectit-ocelot-configurationserver-bom.xml
zip -r ./artifacts/software-bill-of-materials.zip ./boms
- name: Calculate checksums of release artifacts
working-directory: ./artifacts
run: for f in *; do sha256sum "$f" >> inspectit-ocelot-sha256-checksums.txt; done
- name: "Get previous tag"
id: previoustag
# this gets the tag of the previous release based on the tags in the repo
run: echo "tag=$(git ls-remote --tags | cut --delimiter='/' --fields=3 | tail --lines=2 | head -n -1)" >> $GITHUB_OUTPUT
- name: "Build Changelog"
id: build_changelog
uses: danipaniii/action-github-changelog-generator@v1.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
sinceTag: ${{ steps.previoustag.outputs.tag }}
dateFormat:
maxIssues: 500
unreleased: false
author: false
headerLabel: "## Changelog"
stripGeneratorNotice: true
- name: Create Release
uses: softprops/action-gh-release@v0.1.14
with:
tag_name: ${{ github.event.inputs.boomerang-version }}
files: artifacts/*
generate_release_notes: false
token: ${{ github.token }}
name: Version ${{ github.ref_name }}
body: |
"You can also find the corresponding documentation online under the following link: [inspectIT Ocelot Documentation](http://docs.inspectit.rocks)"
${{ steps.build_changelog.outputs.changelog }}
build_and_publish_docker_images:
name: "Build and Push Docker Images"
runs-on: ubuntu-latest
needs: build_and_release
environment: release
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17 # Spring 3 needs at least java 17
distribution: temurin
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build Docker Images
run: ./gradlew dockerTag -PbuildVersion=${{ github.ref_name }}
- name: Push Docker Images
run: |
docker login -u ${{ secrets.DOCKER_HUB_USER }} -p ${{ secrets.DOCKER_HUB_PASSWORD }}
docker push inspectit/inspectit-ocelot-agent:${{ github.ref_name }}
docker push inspectit/inspectit-ocelot-agent:latest
docker push inspectit/inspectit-ocelot-configurationserver:${{ github.ref_name }}
docker push inspectit/inspectit-ocelot-configurationserver:latest
build_documentation:
name: "Build and Publish Release Documentation"
runs-on: ubuntu-latest
environment: release
defaults:
run:
working-directory: inspectit-ocelot-documentation/website
needs: build_and_release
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Uses Personal Access Token of Github user NTTechnicalUser.
# This stores git credentials for all subsequent steps.
# Currently, we only need it for step _Create new Documentation
# Version_.
# Otherwise that step is not allowed to push to master, as it is a
# protected branch.
token: ${{ secrets.RELEASE_USER_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
cache-dependency-path: 'inspectit-ocelot-documentation/website/yarn.lock'
- name: Replace Variables in Docs
working-directory: ./inspectit-ocelot-documentation/docs
run: |
find . -type f -print0 | xargs -0 sed -i 's/{inspectit-ocelot-version}/'"${{ github.ref_name }}"'/g'
OPEN_CENSUS_VERSION=$(grep -oP 'ioOpencensus\s*=\s*"\K[^"]+' ../../gradle/libs.versions.toml)
find . -type f -print0 | xargs -0 sed -i 's/{opencensus-version}/'"${OPEN_CENSUS_VERSION}"'/g'
- name: Create new Documentation Version
run: |
npm install
npm run version ${{ github.ref_name }}
git add versions.json versioned_docs versioned_sidebars
git config --global user.name 'NTTechnicalUser'
git config --global user.email 'NTTechnicalUser@users.noreply.github.com'
git commit -m "Publish documentation for release ${{ github.ref_name }}"
git push -f origin HEAD:master
- name: Install Build Dependencies
run: yarn install --frozen-lockfile
- name: Build Website
run: yarn build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./inspectit-ocelot-documentation/website/build/inspectit-ocelot
user_name: NTTechnicalUser
user_email: NTTechnicalUser@users.noreply.github.com
commit_message: Publish documentation for release ${{ github.ref_name }}