Skip to content

Commit

Permalink
Add a workflow that releases all the Java modules
Browse files Browse the repository at this point in the history
  • Loading branch information
markpatton committed Dec 4, 2023
1 parent c129f12 commit 9ea5140
Showing 1 changed file with 126 additions and 3 deletions.
129 changes: 126 additions & 3 deletions .github/workflows/pass-java-release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,133 @@
name: Placeholder for consolidated Java release
name: "Publish: release all java modules"

on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
nextversion:
description: 'Next dev version'
required: true
push:
branches:
- 'main'

jobs:
test:
release:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
env:
RELEASE: ${{ inputs.releaseversion }}
NEXT: ${{ inputs.nextversion }}
steps:
- run: echo "Hello Moo!"
- name: Setup Java & Maven
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Checkout main
uses: actions/checkout@v3
with:
path: main

- name: Checkout pass-core
uses: actions/checkout@v3
with:
repository: eclipse-pass/pass-core
token: ${{ secrets.GH_PAT }}
path: pass-core

- name: Checkout pass-support
uses: actions/checkout@v3
with:
repository: eclipse-pass/pass-support
token: ${{ secrets.GH_PAT }}
path: pass-support

- name: Config git user
run: |
git config user.name ${{ github.actor }}
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Set the release version, commit the change, and tag it
run: |
cd main && mvn versions:set -DnewVersion=$RELEASE && git commit -am "Update version to $RELEASE" && git tag $RELEASE
cd pass-support && mvn versions:set -DnewVersion=$RELEASE && git commit -am "Update version to $RELEASE" && git tag $RELEASE
cd pass-core && mvn versions:set -DnewVersion=$RELEASE && git commit -am "Update version to $RELEASE" && git tag $RELEASE
cd combined && mvn versions:set -DnewVersion=$RELEASE
- name: Create combined module
run: |
mkdir combined
cp main/pom.xml combined
cp -r pass-core combined
cp -r pass-support combined
sed -i '/<\/developers>/a <modules><module>pass-core</module><module>pass-support</module></modules>' main/pom.xml
- 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: Release Java modules
working-directory: combined
run: |
mvn -B -U -V -ntp -P release clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Set the next dev version, commit the change, and tag it
run: |
cd main && mvn versions:set -DnewVersion=$NEXT && git commit -am "Update version to $NEXT" && git tag $NEXT
cd pass-support && mvn versions:set -DnewVersion=$NEXT && git commit -am "Update version to $NEXT" && git tag $NEXT
cd pass-core && mvn versions:set -DnewVersion=$NEXT && git commit -am "Update version to $NEXT" && git tag $NEXT
cd combined && mvn versions:set -DnewVersion=$NEXT
- name: Release dev Java modules
working-directory: combined
run: |
mvn -B -U -V -ntp -P release 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 image 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 pass-core && git push origin && git push origin --tags
cd pass-core && git push origin && git push origin --tags

0 comments on commit 9ea5140

Please sign in to comment.