diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d300ff61 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: Publish to Maven Central + +on: + push: + tags: + - "*" + +permissions: + contents: read + +concurrency: + group: maven-central-publish + cancel-in-progress: false + +jobs: + publish: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + + - name: Require tag to match pom version + run: | + version=$(python3 - <<'PY' + import xml.etree.ElementTree as ET + root = ET.parse("pom.xml").getroot() + print(root.findtext("{http://maven.apache.org/POM/4.0.0}version") or "") + PY + ) + if [ -z "$version" ]; then + echo "::error::Could not read project version from pom.xml" + exit 1 + fi + if [ "$version" != "$GITHUB_REF_NAME" ]; then + echo "::error::Tag '$GITHUB_REF_NAME' does not match pom version '$version'." + exit 1 + fi + case "$version" in + *-SNAPSHOT) + echo "::error::Refusing to publish SNAPSHOT version '$version'." + exit 1 + ;; + esac + + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 21 + cache: maven + server-id: central + server-username: CENTRAL_USERNAME + server-password: CENTRAL_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: GPG_PASSPHRASE + + - name: Publish + run: ./mvnw -B deploy + env: + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/README.md b/README.md index 2bea7193..e12967a1 100644 --- a/README.md +++ b/README.md @@ -24,19 +24,19 @@ Add the following to your `pom.xml` file: com.kosherjava zmanim - 3.0.0 + 3.1.0 ``` #### Gradle Add the following to your `build.gradle` file: ```groovy -implementation 'com.kosherjava:zmanim:3.0.0' +implementation 'com.kosherjava:zmanim:3.1.0' ``` Or if you have `build.gradle.kts` file: ```kotlin -implementation("com.kosherjava:zmanim:3.0.0") +implementation("com.kosherjava:zmanim:3.1.0") ``` diff --git a/build.gradle b/build.gradle index 802fc7ca..11008e5e 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ dependencies { } group = 'com.kosherjava' -version = '3.0.1-SNAPSHOT' +version = '3.1.1-SNAPSHOT' java { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/pom.xml b/pom.xml index 01e0b9f9..4befcc8b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.kosherjava zmanim - 3.0.1-SNAPSHOT + 3.1.1-SNAPSHOT KosherJava Zmanim The Zmanim library is an API for a specialized calendar that can calculate different astronomical times