Skip to content

Commit

Permalink
Update dependencies (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: kaklakariada <[email protected]>
Co-authored-by: kaklakariada <[email protected]>
  • Loading branch information
3 people authored Sep 2, 2024
1 parent 7a33ce3 commit 57f4a05
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 116 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
matrix-build:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -39,13 +41,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
if: always()
with:
report_paths: '**/target/surefire-reports/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}


build:
needs: matrix-build
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

permissions:
contents: read
security-events: write
strategy:
fail-fast: false

Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/github_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

base_dir="$( cd "$(dirname "$0")/../.." >/dev/null 2>&1 ; pwd -P )"
readonly base_dir
readonly pom_file="$base_dir/pom.xml"

# Read project version from pom file
project_version=$(grep "<version>" "$pom_file" | sed --regexp-extended 's/\s*<version>(.*)<\/version>\s*/\1/g' | head --lines=1)
readonly project_version
echo "Read project version '$project_version' from $pom_file"

# Create GitHub release
readonly changes_file="$base_dir/doc/changes/changes_${project_version}.md"
notes=$(cat "$changes_file")
readonly notes

readonly title="Release $project_version"
readonly tag="$project_version"
echo "Creating release:"
echo "Git tag : $tag"
echo "Title : $title"
echo "Changes file : $changes_file"

release_url=$(gh release create --latest --title "$title" --notes "$notes" --target main "$tag")
readonly release_url
echo "Release URL: $release_url"
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release

on:
workflow_dispatch:
inputs:
skip-deploy-maven-central:
description: "Skip deployment to Maven Central"
required: true
type: boolean
default: false

jobs:
release:
runs-on: ubuntu-latest
defaults:
run:
shell: "bash"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write # Required for creating GitHub release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Fail if not running on main branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main')
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 11
cache: "maven"
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Build
run: mvn --batch-mode -T 1C clean install

- name: List secret GPG keys
run: gpg --list-secret-keys

- name: Publish to Maven Central Repository
if: ${{ !inputs.skip-deploy-maven-central }}
run: mvn --batch-mode deploy -Possrh -DstagingDescription="Deployed via GitHub workflow release.yml"
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

- name: Create GitHub Release
run: ./.github/workflows/github_release.sh
env:
GH_TOKEN: ${{ github.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.settings/org.eclipse.jdt.apt.core.prefs
/.settings/org.eclipse.m2e.core.prefs
/.settings/org.eclipse.core.resources.prefs
/target/
/bin/
/.project
Expand Down
4 changes: 0 additions & 4 deletions .settings/org.eclipse.core.resources.prefs

This file was deleted.

4 changes: 3 additions & 1 deletion doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Changes

* [2.0.2](changes_2.0.2.md)
* [2.0.1](changes_2.0.1.md)
* [2.0.0](changes_2.0.0.md)
* [1.0.0](changes_1.0.0.md)
* [1.0.0](changes_1.0.0.md)
17 changes: 17 additions & 0 deletions doc/changes/changes_2.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# hamcrest-multiline-text-matcher 2.0.1, released 2021-04-17

Codename: Update dependencies on top of 2.0.0

## Summary

In version 2.0.1 we updated dependencies.

## Changes

* #6: Migrated deployment from JCentral to Maven Central
* #8: Updated dependencies

## Bugfixes

* #3: Fixed links in developer guide
* #7: Run Sonar only when token is available
11 changes: 11 additions & 0 deletions doc/changes/changes_2.0.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# hamcrest-multiline-text-matcher 2.0.2, released 2024-09-02

Codename: Update dependencies on top of 2.0.1

## Summary

In version 2.0.1 we updated dependencies and plugins and updated to Hamcrest 3.0. We also added tests using Java 17 and 21.

## Changes

* #9: Updated dependencies
41 changes: 6 additions & 35 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,12 @@ mvn versions:display-dependency-updates
mvn versions:display-plugin-updates
```

## Publishing to Maven Central

1. Add the following to your `~/.m2/settings.xml`:

```xml
<settings>
<servers>
<server>
<id>ossrh</id>
<username>your-jira-id</username>
<password>your-jira-pwd</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>the_pass_phrase</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
```

1. Checkout the `main` branch.
1. Update version in `pom.xml`, commit and push.
1. Run command

```bash
mvn -DskipSigningArtifacts=false clean deploy
```
## Creating a Release on Maven Central and GitHub

1. Start the release workflow
* Run command `gh workflow run release.yml --repo itsallcode/hamcrest-mutliline-text-matcher --ref main`
* or go to [GitHub Actions](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/actions/workflows/release.yml) and start the `release.yml` workflow on branch `main`.
2. Update title and description of the newly created [GitHub release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases).
3. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
1. Create a [release](https://github.com/itsallcode/hamcrest-mutliline-text-matcher/releases) of the `main` branch on GitHub.
1. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/hamcrest-mutliline-text-matcher/).
25 changes: 0 additions & 25 deletions launch/MultilineTextMatcher - all tests coverage.launch

This file was deleted.

20 changes: 0 additions & 20 deletions launch/MultilineTextMatcher - license update.launch

This file was deleted.

Loading

0 comments on commit 57f4a05

Please sign in to comment.