Skip to content

Commit

Permalink
Merge branch 'dev' into fix/logging-invalidpathexception
Browse files Browse the repository at this point in the history
  • Loading branch information
dgautier authored Oct 18, 2023
2 parents 56e4d0c + 1feaabd commit 1bcbbc3
Show file tree
Hide file tree
Showing 29 changed files with 463 additions and 239 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
88 changes: 27 additions & 61 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
name: Build and package
name: Build and Deploy Snapshots
on:
push:
branches:
- master
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to create release for if not empty'
required: false
default: ''

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
Expand All @@ -24,55 +17,28 @@ jobs:
java-version: '11'
distribution: 'adopt'
cache: maven
# To handle both tag and manual runs, run a script that will define all required vars
- name: Define version to build
run: ./.github/define_release_version.sh ${{ github.event.inputs.version }}

# Building application
- name: Build with Maven
run: mvn --batch-mode verify -DversionSuffix=$RELEASE_VERSION_SUFFIX
- run: mkdir dist && cp cli/target/*.tar.gz dist
- uses: actions/upload-artifact@v3
if: env.RELEASE_VERSION == ''
with:
name: cli.tar.gz
path: dist
retention-days: 20

# Pushing to docker registry
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./cli
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_HUB_USER }}/text2confl:${{env.RELEASE_DOCKER_TAG}}
build-args: |
VERSION=${{env.RELEASE_VERSION_SUFFIX}}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USER }}/text2confl:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USER }}/text2confl:buildcache,mode=max

# If there is a tag trigger, creating release
- name: Compute changelog
run: ./.github/create_release_changes.sh
if: startsWith(github.ref, 'refs/tags/')
- name: Create github release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
- name: Deploy to Github packages
run: mvn --batch-mode clean deploy -Pgithub,coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
name: ${{env.RELEASE_VERSION}}
body_path: target/ci/CHANGELOG.md
token: ${{ secrets.RELEASE_TOKEN }}
files: |
dist/*.tar.gz
java-version: '11'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
run: mvn --batch-mode clean deploy -Possrh
env:
GITHUB_REPOSITORY: zeldigas/text2confl
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
23 changes: 5 additions & 18 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,8 @@ jobs:
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn --batch-mode verify
- run: mkdir dist && cp cli/target/*.tar.gz dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build docker image
uses: docker/build-push-action@v5
with:
context: ./cli
platforms: linux/amd64,linux/arm64
push: false
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USER }}/text2confl:buildcache
- uses: actions/upload-artifact@v3
with:
name: cli.tar.gz
path: dist
retention-days: 7
run: mvn --batch-mode verify -Pcoverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release New Version
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- run: |
echo "Release version ${{ github.event.inputs.releaseversion }}!"
- name: Set projects Maven version to GitHub Action GUI set version
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}"
- name: Deploy to Github packages
run: mvn --batch-mode clean deploy -Pgithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Set projects Maven version to GitHub Action GUI set version
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}"
- name: Publish to the Maven Central Repository
run: mvn --batch-mode clean deploy -Possrh
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.releaseversion }}
release_name: ${{ github.event.inputs.releaseversion }}
body: |
### Things that changed in this release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false

13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
## Disclaimer

This is a fork of original [Text2Confl](https://github.com/zeldigas/text2confl)

It's main purposes is to deploy artifacts to maven central.


# text2confl

![](https://img.shields.io/docker/v/zeldigas/text2confl?label=latest%20version&sort=semver) ![](https://img.shields.io/docker/image-size/zeldigas/text2confl?label=docker%20image%20size&sort=semver)

![](https://img.shields.io/docker/v/zeldigas/text2confl?label=docker%20version&sort=semver) ![](https://img.shields.io/docker/image-size/zeldigas/text2confl?label=docker%20image%20size&sort=semver)

[![maven-central](https://img.shields.io/maven-central/v/io.github.text2confl/cli.svg)](https://search.maven.org/artifact/io.github.text2confl/cli) ![codecov](https://codecov.io/gh/text2confl/text2confl/branch/master/graph/badge.svg)


Is a tool for publishing documentation written in structured text formats like markdown to Confluence (either server or
cloud edition).
Expand Down
36 changes: 22 additions & 14 deletions cli/pom.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.github.zeldigas.confluence</groupId>
<groupId>io.github.text2confl</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>0.16.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>cli</artifactId>

<properties>
<!--version suffix is redefined in ci pipelines-->
<versionSuffix/>
</properties>
<artifactId>text2confl-cli</artifactId>
<name>Text2Confl Command Line Interface</name>

<build>
<finalName>text2confl${versionSuffix}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib</classpathPrefix>
<mainClass>com.github.zeldigas.text2confl.cli.MainKt</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
Expand Down Expand Up @@ -50,6 +57,7 @@
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/cli-package.xml</descriptor>
</descriptors>
Expand Down Expand Up @@ -83,8 +91,8 @@
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>com.github.zeldigas.confluence</groupId>
<artifactId>core</artifactId>
<groupId>io.github.text2confl</groupId>
<artifactId>text2confl-core</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down
31 changes: 14 additions & 17 deletions cli/src/assembly/cli-package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,29 @@
<format>tar.gz</format>
<format>dir</format>
</formats>
<dependencySets>
<dependencySet>
<excludes>
<exclude>com.github.zeldigas.*</exclude>
</excludes>
<outputDirectory>lib</outputDirectory>
</dependencySet>
<dependencySet>
<includes>
<include>com.github.zeldigas.*</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
<outputDirectory>app</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>src/assembly/bin</directory>
<directory>${project.basedir}/src/assembly/bin</directory>
<fileMode>755</fileMode>
<outputDirectory/>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source> ${project.build.directory}/${project.artifactId}-${project.version}.jar</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>../LICENSE</source>
<outputDirectory/>
</file>
</files>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>${project.groupId}:${project.artifactId}:jar:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ internal class UploadTest(
internal fun `Data from yaml config file`(@TempDir tempDir: Path) {
val directoryConfig = sampleConfig().copy(tenant = "test1")
directoryConfig.docsDir = tempDir
writeToFile(tempDir.resolve(".text2confl.yml"), directoryConfig)
writeToFile(tempDir.resolve("text2confl.yml"), directoryConfig)

val result = mockk<List<Page>>()
every { converter.convertDir(tempDir) } returns result
Expand Down
13 changes: 6 additions & 7 deletions confluence-client/pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.github.text2confl</groupId>
<artifactId>parent</artifactId>
<groupId>com.github.zeldigas.confluence</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>0.16.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>confluence-client</artifactId>

<artifactId>text2confl-confluence-client</artifactId>
<name>Text2Confl Confluence Client</name>
<description>Implementation of http client for confluence</description>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ interface ConfluenceClient {
class PageNotCreatedException(val title: String, val status: Int, val body: String?) :
RuntimeException("Failed to create '$title' page: status=$status, body:\n$body")

class PageNotUpdatedException(val id: String, val status: Int, val body: String?) :
RuntimeException("Failed to update '$id' page: status=$status, body:\n$body")

class PageNotFoundException : RuntimeException()

class TooManyPagesFound(val pages: List<ConfluencePage>) : RuntimeException()
Loading

0 comments on commit 1bcbbc3

Please sign in to comment.