From 284a9cdfed088e0eaaa1bafe2296d4bcbb81f65a Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 12 Oct 2023 18:55:24 +0200 Subject: [PATCH] refactor action, clean changelog --- .github/workflows/release.yml | 86 +++++++++++++++------------- CHANGELOG.md | 104 +++++++--------------------------- pom.xml | 2 +- 3 files changed, 68 insertions(+), 124 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f96473..1eed9e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,15 +8,41 @@ on: jobs: release: runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[ci skip]')" + if: ${{ ! contains(github.event.head_commit.message, '[ci skip]') }} steps: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: Extract data from pom.xml + id: pom-data + uses: andreacomo/maven-gav-extractor@v2 + + - name: Get Changelog Entry based on pom.xml version + id: changelog_for_pom_version + uses: mindsers/changelog-reader-action@v2 + with: + version: ${{ steps.pom-data.outputs.version }} + validation_level: error + validation_depth: 5 + + - name: check tag on version + uses: mukunku/tag-exists-action@v1.1.0 + id: tag-for-pom-version + with: + tag: OpenKIM-${{ steps.pom-data.outputs.version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: cancel action on tag exist + if: steps.tag-for-pom-version.outputs.exists == 'true' + run: | + echo "::error::Tag for version ${{ steps.pom-data.outputs.version }} already exist." + exit 1 + - name: Set up JDK 17 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 17 distribution: 'zulu' @@ -28,55 +54,28 @@ jobs: git config --global user.name "Release Bot" git clone https://github.com/gematik/api-telematik.git - - name: Extract release notes - id: extract-release-notes - uses: ffurrer2/extract-release-notes@v1 - - name: Build with Maven id: build_maven run: | mvn -B package --file pom.xml - VERSION=$(mvn --non-recursive help:evaluate -Dexpression=project.version -q -DforceStdout | grep -v '\[.*') - echo "::set-output name=version::$VERSION" - - - uses: mukunku/tag-exists-action@v1.1.0 - id: checkTag - with: - tag: OpenKIM-${{ steps.build_maven.outputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish new version - if: steps.checkTag.outputs.exists == 'false' - uses: svenstaro/upload-release-action@v2 - with: - repo_name: sberg-net/openkim - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/openkim-${{ steps.build_maven.outputs.version }}.jar - tag: OpenKIM-${{ steps.build_maven.outputs.version }} - overwrite: false - body: ${{ steps.extract-release-notes.outputs.release_notes }} - name: Docker meta - if: steps.checkTag.outputs.exists == 'false' id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: | - sbergit/openkim + ${{ secrets.DOCKER_HUB_USER }}/openkim tags: | type=raw,value=latest - type=match,pattern=[0-9]+.[0-9]+.[0-9]+,value=v${{ steps.build_maven.outputs.version }} - #type=match,pattern=[0-9]+.[0-9]+,value=v${{ steps.build_maven.outputs.version }} + type=match,pattern=[0-9]+.[0-9]+.[0-9]+,value=v${{ steps.pom-data.outputs.version }} + #type=match,pattern=[0-9]+.[0-9]+,value=v${{ steps.pom-data.outputs.version }} #type=sha - name: Set up Docker Buildx - if: steps.checkTag.outputs.exists == 'false' id: buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Inspect builder - if: steps.checkTag.outputs.exists == 'false' run: | echo "Name: ${{ steps.buildx.outputs.name }}" echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" @@ -86,15 +85,13 @@ jobs: echo "Tags: ${{ steps.meta.outputs.tags }}" - name: Login to DockerHub - if: steps.checkTag.outputs.exists == 'false' uses: docker/login-action@v3 with: - username: sbergit - password: ${{ secrets.DOCKER_HUB }} + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} - - name: Build and push - if: steps.checkTag.outputs.exists == 'false' - uses: docker/build-push-action@v2 + - name: Build and push docker images + uses: docker/build-push-action@v5 with: context: . file: docker/Dockerfile @@ -104,3 +101,12 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + + - name: Publish new version + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: target/openkim-${{ steps.pom-data.outputs.version }}.jar + tag: OpenKIM-${{ steps.pom-data.outputs.version }} + overwrite: false + body: ${{ steps.changelog_for_pom_version.outputs.changes }} diff --git a/CHANGELOG.md b/CHANGELOG.md index ff5aa1f..fdd0565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,26 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [0.18.2] +### Added + +### Changed + +### Fixed + +## [0.19.0] ### Added -- arm64 Docker Image +- arm64 docker image to dockerHub + +### Changed + +- refactor release action ## [0.18.1] @@ -50,54 +60,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.14.1] -### Added -``` -``` - -### Changed -``` -``` - ### Fixed -``` + - Pipeline-Operationen -``` + ## [0.14.0] ### Added -``` + - OpenKIM im Modus keine TI getestet - SMTP/POP3 - Protokoll des Gateways getestet -``` -### Changed -``` -``` - -### Fixed -``` -``` ## [0.13.1] -### Added -``` -``` - -### Changed -``` -``` - ### Fixed -``` + - Pipeline-Struktur -``` + ## [0.13.0] ### Added -``` + - Hinzufügen einer Pipeline-Struktur für die Operationen (z.b. Signieren einer Mail) - bessere Test- und Erweiterbarkeit - besseres Handling der Komplexität @@ -106,67 +92,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Testen ohne Fachdienst-Servern, mit Konnektor und mit "handelsüblichen" Mailservern -> Checken, ob die Konnektor-Kommunikation funktioniert - Testen "Fullstack" -> mit Fachdienst-Servern und Konnektor - Weitere Umbauarbeiten -``` - -### Changed -``` -``` - -### Fixed -``` -``` ## [0.12.0] ### Added -``` + - Hinzufügen einer Pipeline-Struktur für die Operationen (z.b. Signieren einer Mail) - bessere Test- und Erweiterbarkeit -``` - -### Changed -``` -``` - -### Fixed -``` -``` -## [0.11.0] - -### Added -``` -``` - -### Changed -``` -``` - -### Fixed -``` -``` ## [0.9.0] ### Added -``` + - Erstellen des Git-Repositorys - Github Actions - Dockerfile inklusive build und push zu [Dockerhub] -``` - -### Changed -``` -``` - -### Fixed -``` -``` - -[unreleased]: https://github.com/sberg-net/openkim/compare/0.12.0...HEAD -[0.12.0]: https://github.com/sberg-net/openkim/releases/tag/OpenKIM-0.12.0 -[0.11.0]: https://github.com/sberg-net/openkim/releases/tag/OpenKIM-0.11.0 -[0.10.0-dev1]: https://github.com/sberg-net/openkim/releases/tag/OpenKIM-0.10.0-dev1 -[0.9.1]: https://github.com/sberg-net/openkim/releases/tag/OpenKIM-0.9.1 -[0.9.0]: https://github.com/sberg-net/openkim/releases/tag/OpenKIM-0.9.0 -[dockerhub]: https://hub.docker.com/repository/docker/sbergit/openkim diff --git a/pom.xml b/pom.xml index dcba005..5270764 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ net.sberg openkim - 0.18.2 + 0.19.0 openkim Open KIM Client Modul