Have a look at the nexus-staging-maven-plugin.
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
</configuration>
</plugin>
You can configure the plugin to automatically release the staging repository (autoReleaseAfterClose=true).
I.e, this makes the nexus workflow transparent.
You could also implement the workflow manually. (skipStagingRepositoryClose=true)
# Create the nexus staging repository
STAGING_DESC="Project ACME v${FULL_VERSION}"
mvn nexus-staging:rc-open \
-DstagingProfileId=6026dab46eed94 \
-DstagingDescription="${STAGING_DESC}"
STAGING_REPO_ID=$(mvn nexus-staging:rc-list | \
egrep "^\[INFO\] orgacme\-[0-9]+[ ]+OPEN[ ]+${STAGING_DESC}" | \
awk '{print $2}' | head -1)
# Perform deployment
mvn deploy -DstagingRepositoryId=${STAGING_REPO_ID}
# Close and release the nexus staging repository
mvn nexus-staging:rc-close nexus-staging:rc-release \
-DstagingRepositoryId=${STAGING_REPO_ID} \
-DstagingDescription="${STAGING_DESC}"