diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 7ba3fe1..fcb84bb 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -4,8 +4,10 @@ name: Maven Package on: - release: - types: [created] + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 jobs: build: @@ -15,11 +17,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Java for Apache Maven Central - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Cache Maven packages uses: actions/cache@v2 with: @@ -27,9 +24,52 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 + - name: Set up Java for Apache Maven Central + uses: actions/setup-java@v1 + with: + java-version: 11 + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + server-username: OSSRH_USERNAME # env variable for username in deploy + server-password: OSSRH_PASSWORD # env variable for token in deploy + gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase + + - name: Import GPG keys + run: 'echo -e "$GPG_FILE" | gpg2 --import --no-tty --batch --yes' + shell: bash + env: + GPG_FILE: ${{secrets.GPG_FILE}} + + - name: Build with Maven + run: mvn --batch-mode --update-snapshots clean compile verify + - name: Publish to Apache Maven Central - run: mvn deploy --batch-mode --update-snapshots -P sign,build-extras + # run: mvn deploy --batch-mode --update-snapshots -P sign,!build-extras -Dmaven.test.skip=true + run: mvn deploy --batch-mode --update-snapshots -P sign,!build-extras -Dmaven.test.skip=true env: OSSRH_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + + - name: Set up Java for publishing to GitHub Packages + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Publish to GitHub Packages + run: mvn deploy --batch-mode --update-snapshots -P sign,!build-extras,!deploy-ossrh -Dmaven.test.skip=true -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/csowada/ebus + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + Changes in this Release + + draft: true + prerelease: false \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 6c69f72..c3cc9b0 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -18,11 +18,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Java - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Cache Maven packages uses: actions/cache@v2 with: @@ -30,6 +25,11 @@ jobs: key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 + - name: Set up Java + uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Build witrh Maven run: mvn --batch-mode --update-snapshots clean compile verify diff --git a/BUILD-HELP.md b/BUILD-HELP.md new file mode 100644 index 0000000..a56296e --- /dev/null +++ b/BUILD-HELP.md @@ -0,0 +1,8 @@ +# Build Handbook + +## Maven Release + +```bash +# create a new release +mvn gitflow:release +``` \ No newline at end of file diff --git a/pom.xml b/pom.xml index d836a73..78568b2 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ eBUS core library - This library handles the communication with heating engineering via the BUS specification. This protocol is used by many heating manufacturers in Europe. de.cs-dev.ebus ebus-core - 1.1.0 + 1.1.1 https://github.com/csowada/ebus bundle @@ -18,7 +18,7 @@ 1.8 8 2020 - 1.1.0.${maven.build.timestamp} + @@ -57,6 +57,22 @@ + + com.amashchenko.maven.plugin + gitflow-maven-plugin + 1.15.0 + + + master + develop + v + origin + + false + false + + + org.codehaus.mojo buildnumber-maven-plugin @@ -92,8 +108,7 @@ ${bundle.version} de.csdev.ebus.* resolution:=optional - org.slf4j;$[opt], com.fazecast.jSerialComm;$[opt], gnu.io;$[opt], - org.eclipse.jdt.annotation;$[opt], * + org.slf4j;$[opt], com.fazecast.jSerialComm;$[opt], gnu.io;$[opt], * ${maven.build.timestamp} ${buildNumber} @@ -103,18 +118,6 @@ - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 - true - - ossrh - https://oss.sonatype.org/ - false - - - com.mycila license-maven-plugin @@ -215,6 +218,9 @@ org.apache.maven.plugins maven-javadoc-plugin 3.0.0 + + none + attach-javadocs @@ -228,6 +234,39 @@ + + deploy-ossrh + + true + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + false + + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + @@ -306,15 +345,4 @@ - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - -