Skip to content

fix: move public dir (#1661) #23

fix: move public dir (#1661)

fix: move public dir (#1661) #23

Workflow file for this run

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 }}