Skip to content

Release to maven central #9

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

Merged
merged 9 commits into from
Apr 15, 2023
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
6 changes: 4 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: CDEvents
name: Linter
on:
pull_request:
branches: [ main ]
branches: [main]
jobs:
build:
name: Lint Code Base
Expand All @@ -19,3 +19,5 @@ jobs:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# mvnw is provided as is from the Maven Wrapper project. Can't change it
FILTER_REGEX_EXCLUDE: .*mvnw
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true

env:
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'
USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
USER_NAME: 'GitHub Action'

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Cache Maven
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Version
run: |
VERSION=${{ github.event.inputs.version }}
echo "Updating POMs to version $VERSION"
./mvnw -B versions:set versions:commit -DnewVersion=$VERSION
git config --global user.email "${{ env.USER_EMAIL }}"
git config --global user.name "${{ env.USER_NAME }}"
git commit -a -m "Releasing version $VERSION"
git push origin main

- name: Release
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
GPG_TTY=$(tty)
export GPG_TTY
./mvnw --no-transfer-progress -B --file pom.xml \
-Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \
-Dmaven.site.skip=true -Drelease=true deploy
29 changes: 19 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---
name: CDEvents
name: Test
on:
pull_request:
branches: [ main ]
branches: [main]

env:
JAVA_VERSION: '11'
JAVA_DISTRO: 'zulu'

jobs:
build:
name: Unit Test
Expand All @@ -12,15 +17,19 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 14
uses: actions/setup-java@v1

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 14
- name: Cache Maven packages
uses: actions/cache@v2
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}

- name: Cache Maven
uses: actions/cache@v3
with:
path: ~/.m2
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Test with Maven
run: mvn -B test --file pom.xml

- name: Build
run: ./mvnw --no-transfer-progress -B --file pom.xml verify
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
Expand All @@ -28,5 +27,8 @@ hs_err_pid*
.project

# IntelliJ files
.idea
*.iml
.idea/
*.iml

# Maven output
target/
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -198,4 +199,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
Loading