Skip to content

Commit

Permalink
Fix server-id, validate version
Browse files Browse the repository at this point in the history
  • Loading branch information
pnacht committed Feb 8, 2023
1 parent 07b35e1 commit d72ce51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
push:
tags:
- "*"
- "!*-rc*"
- "!*.pr*"
- "!*b"

Expand All @@ -18,18 +17,22 @@ jobs:
runs-on: "ubuntu-20.04"
env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
TAG: ${{ github.ref_name }}
outputs:
hash: ${{ steps.hash.outputs.hash }}
artifact_name: ${{ steps.hash.outputs.artifact_name }}
steps:
- name: Validate version name
run: |
[[ $TAG =~ jackson-core-[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)? ]] || exit 1
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "8"
cache: "maven"
server-id: sonatype-nexus-snapshots
server-id: sonatype-nexus-staging
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
# See https://github.com/actions/setup-java/blob/v2/docs/advanced-usage.md#Publishing-using-Apache-Maven
Expand Down
22 changes: 12 additions & 10 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash

# This script simulates the Maven Release Plugin, but only performs release:clean and
# release:prepare. The release:perform step is handled by the CI when the tag is
# pushed.
# This script simulates the Maven Release Plugin, but only performs
# release:clean and release:prepare. The release:perform step is handled by the
# CI when the tag is pushed.
#
# However, release:perform on Git requires the release.properties file. We must
# therefore modify the first commit created by release:prepare to include this file, and
# then delete the file in the second commit.
# therefore modify the first commit created by release:prepare to include this
# file, and then delete the file in the second commit.
#
# This will ensure that release.properties is available to release:perform in the CI,
# while keeping with the expectation that this file does not get commited (long-term) to
# the repository.
# This will ensure that release.properties is available to release:perform in
# the CI, while keeping with the expectation that this file does not get
# commited (long-term) to the repository.

set -euo pipefail

Expand All @@ -21,7 +21,7 @@ set -euo pipefail
git reset HEAD~1

# delete tag created by release:prepare
tag_name=$(git tag --points-at)
tag_name="$(git tag --points-at)"
git tag -d "$tag_name"

# Add release.properties to that commit
Expand All @@ -31,7 +31,8 @@ git commit --amend --no-edit
# recreate tag
git tag "$tag_name" -m "[maven-release-plugin] copy for tag $tag_name"

# Recreate second commit, removing release.properties from the repository
# Recreate second commit (from release to SNAPSHOT), removing
# release.properties from the repository
git rm release.properties
git add pom.xml
git commit -m "[maven-release-plugin] prepare for next development iteration"
Expand All @@ -40,4 +41,5 @@ git commit -m "[maven-release-plugin] prepare for next development iteration"
git push
git push origin "$tag_name"

# clean up
rm pom.xml.releaseBackup

0 comments on commit d72ce51

Please sign in to comment.