Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check

on:
push:
branches: [ main ]
paths-ignore: ['**.md', 'doc/**']
pull_request:
branches: [ main ]
paths-ignore: ['**.md', 'doc/**']
workflow_call:

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Code
uses: actions/checkout@v7

- name: Setup Java
uses: actions/setup-java@v6
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'

- name: Build Code
run: mvn -B clean verify
53 changes: 41 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
name: Publish package to GitHub Packages
name: Release

on:
workflow_dispatch:
release:
types: [created]
push:
tags:
- 'v[0-9]*'

jobs:
publish:
check:
name: Check
uses: ./.github/workflows/check.yml

release:
name: Release
runs-on: ubuntu-latest
needs: check
permissions:
contents: read
contents: write
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- name: Extract Version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"

- name: Checkout Code
uses: actions/checkout@v7

- name: Setup Java
uses: actions/setup-java@v6
with:
java-version: '11'
distribution: 'adopt'
- name: Publish package
run: mvn --batch-mode deploy
java-version: '21'
distribution: 'temurin'
cache: 'maven'

- name: Build & Deploy to GitHub Packages
run: mvn -B deploy -Drevision=${{ env.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release with Assets
run: >
gh release create ${{ env.VERSION }}
--title "${{ env.VERSION }}"
--draft=false
--prerelease=false
--generate-notes
target/search-webconsole-plugin-${{ env.VERSION }}.jar
target/search-webconsole-plugin-${{ env.VERSION }}-sources.jar
target/search-webconsole-plugin-${{ env.VERSION }}-javadoc.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
.flattened-pom.xml
buildNumber.properties
.mvn/timing.properties
### JetBrains template
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ Since 3.0.0 the plugin is a plain Jakarta Servlet without any Web Console API de
Build and deploy automatically using command: `mvn clean package sling:install`.
Do not hesistate to fork and create pull requests.

## Release

Check the last released version: `sh release.sh`.
Trigger a new release from `main`: `sh release.sh 3.0.0`.
The bundle is then published to [GitHub Packages](https://github.com/neva-dev/felix-search-webconsole-plugin/packages) and attached to [GitHub Releases](https://github.com/neva-dev/felix-search-webconsole-plugin/releases).

## Configuration

### Deployment
Expand Down
29 changes: 25 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>com.neva.felix</groupId>
<artifactId>search-webconsole-plugin</artifactId>
<packaging>bundle</packaging>
<version>3.0.0</version>
<version>${revision}</version>
<name>search-webconsole-plugin</name>
<description>Search everywhere plugin for Apache Felix Web Console</description>
<inceptionYear>2017</inceptionYear>
Expand Down Expand Up @@ -91,9 +91,29 @@

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.8.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
Expand Down Expand Up @@ -273,6 +293,7 @@
</profile>
</profiles>
<properties>
<revision>3.0.0-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<felix.url>http://localhost:8080/system/console</felix.url>
<felix.user>admin</felix.user>
Expand Down
29 changes: 29 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env sh
set -e

VERSION="$1"
VERSION_CURRENT=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
VERSION_CURRENT="${VERSION_CURRENT#v}"

if [ -z "$VERSION" ]; then
echo "$VERSION_CURRENT"
exit 0
fi

BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH" != "main" ]; then
echo "Unable to release. Current branch is '$BRANCH', expected 'main'!" >&2
exit 1
fi

if [ -n "$(git status --porcelain)" ]; then
echo "Unable to release. Uncommitted changes detected!" >&2
exit 1
fi

VERSION_TAG="v${VERSION#v}"

echo "Releasing $VERSION_TAG (previous: $VERSION_CURRENT)"
git push origin main
git tag "$VERSION_TAG"
git push origin "$VERSION_TAG"
Loading