Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ide config and pipelines #2

Merged
merged 2 commits into from
Aug 12, 2024
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
51 changes: 11 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,14 @@
name: Publish package to GitHub Packages
on:
workflow_dispatch:
inputs:
version:
description: "Version name to publish (eg: x.x.x)"
type: string
required: true

jobs:
publish:
timeout-minutes: 15
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
name: Test

- uses: aboutbits/github-actions-java/setup-and-install@v3

- name: Set Version
run: sed -i 's|<version>BUILD-SNAPSHOT</version>|<version>${{ github.event.inputs.version }}</version>|g' pom.xml

- name: Publish package
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
pull_request:
types: [ opened, reopened, synchronize ]

tag:
timeout-minutes: 5
runs-on: ubuntu-22.04
needs: publish
steps:
- uses: actions/checkout@v4
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

- name: Tag Deployment
uses: aboutbits/github-actions-base/git-create-or-update-tag@v1
with:
tag-name: ${{ github.event.inputs.version }}
user-name: 'AboutBits'
user-email: '[email protected]'
jobs:
test:
name: Tests
uses: ./.github/workflows/test.yml
33 changes: 33 additions & 0 deletions .github/workflows/maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">

<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>

<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/aboutbits/*</url>
</repository>
</repositories>
</profile>
</profiles>

<servers>
<server>
<id>github</id>
<username>${env.GITHUB_USER_NAME}</username>
<password>${env.GITHUB_ACCESS_TOKEN}</password>
</server>
</servers>
</settings>
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish package to GitHub Packages
on:
workflow_dispatch:
inputs:
version:
description: "Version name to publish (eg: x.x.x)"
type: string
required: true

jobs:
publish:
timeout-minutes: 15
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- uses: aboutbits/github-actions-java/setup-and-install@v3

- name: Set Version
run: sed -i 's|<version>BUILD-SNAPSHOT</version>|<version>${{ github.event.inputs.version }}</version>|g' pom.xml

- name: Publish package
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

tag:
timeout-minutes: 5
runs-on: ubuntu-22.04
needs: publish
steps:
- uses: actions/checkout@v4

- name: Tag Deployment
uses: aboutbits/github-actions-base/git-create-or-update-tag@v1
with:
tag-name: ${{ github.event.inputs.version }}
user-name: 'AboutBits'
user-email: '[email protected]'
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests

on:
workflow_call:

jobs:
test:
name: Maven-Java
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: aboutbits/github-actions-java/setup@v3
with:
java-version: 21
- run: >-
./mvnw
-s $GITHUB_WORKSPACE/.github/workflows/maven-settings.xml
--batch-mode
--fail-fast
-Dsurefire.failIfNoSpecifiedTests=false
test
env:
GITHUB_USER_NAME: ${{ github.actor }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@ target/
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea/*
!.idea/codeStyles
!.idea/.gitignore
!.idea/checkstyle-idea.xml
!.idea/encodings.xml
!.idea/misc.xml
!.idea/sqldialects.xml
!.idea/vcs.xml

*.iml
*.ipr
*.iws

### NetBeans ###
/nbproject/private/
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Add this library to the classpath by adding the following maven dependency. Vers
The [CustomAccessorNamingStrategy.java](src%2Fmain%2Fjava%2Fit%2Faboutbits%2Fmapstruct%2Fspi%2FCustomAccessorNamingStrategy.java) adds support for Lombok's `@With` methods.
By default, Lombok would treat these generated functions as accessors and would try to map them.

## Local development:

To use this library as a local development dependency, you can simply refer to the version `BUILD-SNAPSHOT`.

Check out this repository and run the maven goal `install`. This will build and install this library as version `BUILD-SNAPSHOT` into your local maven cache.

Note that you may have to tell your IDE to reload your main maven project each time you build the library.

## Building and releasing a new version:

To create a new version of this package and push it to the maven registry, you will have to use the GitHub actions workflow and manually trigger it.
Expand Down