Skip to content

Commit

Permalink
Release mechanism - every push will trigger a release (danfickle#9)
Browse files Browse the repository at this point in the history
Push to anything but main will trigger a dev release, every push to main
a proper GitHub release.

Not sure if you've discussed the release process yet?

Might be worth looking into [JReleaser](https://jreleaser.org/)
  • Loading branch information
madsop-nav authored Mar 4, 2024
1 parent 6c8a4d6 commit 1ead4fa
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 125 deletions.
81 changes: 70 additions & 11 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,73 @@ jobs:
java: ['8','11','17', '21']

steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{matrix.java}}
cache: maven
- name: Maven -v
run: mvn -v
- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/checkout@v4
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{matrix.java}}
cache: maven
- name: Maven -v
run: mvn -v
- name: Build with Maven
run: mvn -B package --file pom.xml


release-dev:
name: Create release - dev
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Upload artifact
run: mvn -B deploy -Dgithub-release -e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: elgohr/Github-Release-Action@v5
with:
title: openhtmltopdf.dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release:
name: Create release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Upload artifact
run: mvn -B deploy -Dgithub-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: elgohr/Github-Release-Action@v5
with:
title: openhtmltopdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 0 additions & 11 deletions openhtmltopdf-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-java2d/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-latex-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-mathml-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-objects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-pdfbox/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-rtl-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
11 changes: 0 additions & 11 deletions openhtmltopdf-svg-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
</license>
</licenses>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
Expand Down
57 changes: 42 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<name>Openhtmltopdf</name>
<description>Open-HTML-to-PDF is a HTML and CSS renderer written in Java. It supports Java2D and PDF output. Open-HTML-to-PDF is a fork of Flying-saucer with additional features.</description>
<url>https://github.com/danfickle/openhtmltopdf</url>
<url>https://github.com/openhtmltopdf/openhtmltopdf</url>

<licenses>
<license>
Expand All @@ -36,23 +36,12 @@
</modules>

<scm>
<connection>scm:git:git://github.com/imario42/openhtmltopdf.git</connection>
<developerConnection>scm:git:https://github.com/imario42/openhtmltopdf.git</developerConnection>
<url>git://github.com/imario42/openhtmltopdf.git</url>
<connection>scm:git:git://github.com/openhtmltopdf/openhtmltopdf.git</connection>
<developerConnection>scm:git:https://github.com/openhtmltopdf/openhtmltopdf.git</developerConnection>
<url>git://github.com/openhtmltopdf/openhtmltopdf.git</url>
<tag>openhtmltopdf-parent-1.1.4</tag>
</scm>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<developers>
<developer>
<id>danfickle</id>
Expand All @@ -74,9 +63,47 @@
<name>Mario Ivankovits</name>
<email>mario@datenwort.at</email>
</developer>
<developer>
<id>madsop-nav</id>
<name>Mads Opheim</name>
<email>mads.opheim@gmail.com</email>
</developer>
</developers>

<profiles>
<profile>
<id>github-release</id>
<activation>
<property>
<name>github-release</name>
</property>
</activation>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/${env.GITHUB_REPOSITORY}</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>maven-release</id>
<activation>
<property>
<name>!github-release</name>
</property>
</activation>
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>
</profile>
<profile>
<id>doclint-java8-disable</id>
<activation>
Expand Down

0 comments on commit 1ead4fa

Please sign in to comment.