-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement workflow to release all Java modules together
- Loading branch information
1 parent
bfcd9b7
commit da68686
Showing
1 changed file
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,137 @@ | ||
name: Placeholder for consolidated Java release | ||
# Build all the Java modules by constructing a synthentic combined module. | ||
# The main repo provides the pom for the combined module, but is kept on the side. | ||
# The combined module is in the directory combined which contains pass-core and pass-support repos. | ||
|
||
name: "Publish: release all Java modules" | ||
run-name: Release all Java modules (${{ inputs.releaseversion }} -> ${{ inputs.nextversion}}) | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releaseversion: | ||
description: 'Release version' | ||
required: true | ||
nextversion: | ||
description: 'Next dev version' | ||
required: true | ||
|
||
jobs: | ||
test: | ||
release: | ||
runs-on: ubuntu-latest | ||
env: | ||
RELEASE: ${{ inputs.releaseversion }} | ||
NEXT: ${{ inputs.nextversion }} | ||
steps: | ||
- run: echo "Hello Moo!" | ||
- name: Checkout main | ||
uses: actions/checkout@v3 | ||
with: | ||
path: main | ||
|
||
- name: Setup Java & Maven | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }} | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
|
||
- name: Get the artifact from the main POM | ||
working-directory: main | ||
run: | | ||
echo "ARTIFACT=`mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout`" >> $GITHUB_ENV | ||
- name: Configure git user | ||
run: | | ||
git config --global user.name ${{ github.actor }} | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
# Combine modules together so maven can do everything at once | ||
- name: Create combined module | ||
run: | | ||
mkdir combined | ||
cp main/pom.xml combined | ||
sed -i '/<\/developers>/a <modules><module>pass-core</module><module>pass-support</module></modules>' combined/pom.xml | ||
- name: Checkout pass-core | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: eclipse-pass/pass-core | ||
path: combined/pass-core | ||
|
||
- name: Checkout pass-support | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: eclipse-pass/pass-support | ||
path: combined/pass-support | ||
|
||
- name: Set the release version, commit the change, and tag it | ||
run: | | ||
(cd main && mvn versions:set -B -ntp -DnewVersion=$RELEASE && git commit -am "Update version to $RELEASE" && git tag $RELEASE) | ||
(cd combined && mvn versions:set -B -ntp -DnewVersion=$RELEASE) | ||
(cd combined/pass-core && git commit -am "Update version to $RELEASE" && git tag $RELEASE) | ||
(cd combined/pass-support && git commit -am "Update version to $RELEASE" && git tag $RELEASE) | ||
- name: Release Java modules | ||
uses: ./main/.github/actions/maven-release | ||
with: | ||
repodir: combined | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
|
||
- name: Set the next dev version and commit the change | ||
run: | | ||
(cd main && mvn versions:set -B -ntp -DnewVersion=$NEXT && git commit -am "Update version to $NEXT") | ||
(cd combined && mvn versions:set -B -ntp -DnewVersion=$NEXT) | ||
(cd combined/pass-core && git commit -am "Update version to $NEXT") | ||
(cd combined/pass-support && git commit -am "Update version to $NEXT") | ||
- name: Release dev Java modules | ||
working-directory: combined | ||
run: | | ||
mvn -B -V -ntp clean deploy -DskipTests -DskipITs | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push Docker images to GHCR | ||
run: | | ||
docker push ghcr.io/eclipse-pass/pass-core-main:$RELEASE | ||
docker push ghcr.io/eclipse-pass/pass-core-main:$NEXT | ||
docker push ghcr.io/eclipse-pass/deposit-services-core:$RELEASE | ||
docker push ghcr.io/eclipse-pass/deposit-services-core:$NEXT | ||
docker push ghcr.io/eclipse-pass/pass-notification-service:$RELEASE | ||
docker push ghcr.io/eclipse-pass/pass-notification-service:$NEXT | ||
docker push ghcr.io/eclipse-pass/jhu-grant-loader:$RELEASE | ||
docker push ghcr.io/eclipse-pass/jhu-grant-loader:$NEXT | ||
docker push ghcr.io/eclipse-pass/pass-journal-loader:$RELEASE | ||
docker push ghcr.io/eclipse-pass/pass-journal-loader:$NEXT | ||
docker push ghcr.io/eclipse-pass/pass-nihms-loader:$RELEASE | ||
docker push ghcr.io/eclipse-pass/pass-nihms-loader:$NEXT | ||
- name: Push the commits and tags | ||
run: | | ||
(cd main && git push origin && git push origin --tags) | ||
(cd combined/pass-core && git push origin && git push origin --tags) | ||
(cd combined/pass-support && git push origin && git push origin --tags) | ||
- name: Create GitHub releases | ||
run: | | ||
gh release create "$RELEASE" --repo=eclipse-pass/main --generate-notes | ||
gh release create "$RELEASE" --repo=eclipse-pass/pass-core --generate-notes | ||
gh release create "$RELEASE" --repo=eclipse-pass/pass-support --generate-notes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |