Release All Modules (1.8.0 -> 1.9.0-SNAPSHOT) #60
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
name: "Publish: Release All" | |
run-name: Release All Modules (${{ inputs.releaseversion }} -> ${{ inputs.nextversion}}) | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseversion: | |
description: 'Release version' | |
required: true | |
nextversion: | |
description: 'Next dev version' | |
required: true | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
RELEASE: ${{ inputs.releaseversion }} | |
NEXT: ${{ inputs.nextversion }} | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v4 | |
with: | |
path: main | |
fetch-depth: 0 | |
- 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" | |
- 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 all released PASS repos | |
run: | | |
git clone https://${{ secrets.JAVA_RELEASE_PAT }}@github.com/eclipse-pass/pass-core.git combined/pass-core | |
git clone https://${{ secrets.JAVA_RELEASE_PAT }}@github.com/eclipse-pass/pass-support.git combined/pass-support | |
git clone https://${{ secrets.JAVA_RELEASE_PAT }}@github.com/eclipse-pass/pass-ui.git combined/pass-ui | |
git clone https://${{ secrets.JAVA_RELEASE_PAT }}@github.com/eclipse-pass/pass-acceptance-testing.git combined/pass-acceptance-testing | |
git clone https://${{ secrets.JAVA_RELEASE_PAT }}@github.com/eclipse-pass/pass-docker.git combined/pass-docker | |
- name: Setup Node & Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.JAVA_RELEASE_PAT }} | |
- name: Check for Release tags | |
run: | | |
(cd main && echo "MAIN_TAG_EXISTS=$(git tag -l "$RELEASE")" >> $GITHUB_ENV) | |
(cd combined/pass-core && echo "PASS_CORE_TAG_EXISTS=$(git tag -l "$RELEASE")" >> $GITHUB_ENV) | |
(cd combined/pass-support && echo "PASS_SUPPORT_TAG_EXISTS=$(git tag -l "$RELEASE")" >> $GITHUB_ENV) | |
(cd combined/pass-ui && echo "PASS_UI_TAG_EXISTS=$(git tag -l "$RELEASE")" >> $GITHUB_ENV) | |
(cd combined/pass-acceptance-testing && echo "PASS_ACCPT_TEST_TAG_EXISTS=$(git tag -l "$RELEASE")" >> $GITHUB_ENV) | |
(cd combined/pass-docker && echo "PASS_DOCKER_TAG_EXISTS=$(git tag -l "$RELEASE")" >> $GITHUB_ENV) | |
- name: Create aggregate tag env vars | |
run: | | |
echo "ALL_JAVA_REPOS_TAG_EXISTS=${{ env.MAIN_TAG_EXISTS && env.PASS_CORE_TAG_EXISTS && env.PASS_SUPPORT_TAG_EXISTS }}" >> $GITHUB_ENV | |
# Note that the Java Repositories uses --force on tagging and pushing tagging. This is to cover the case where | |
# there is a failure during the Push commits and tags step, then the workflow is re-run, we will update any tag | |
# that made it to the remote to the new commit created when updating the version. | |
- name: Set Release/commit/tag ~ Java Repositories | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
run: | | |
(cd main && mvn versions:set -B -ntp -DnewVersion=$RELEASE && git commit --allow-empty -am "Update version to $RELEASE" && git tag --force $RELEASE) | |
(cd combined && mvn versions:set -B -ntp -DnewVersion=$RELEASE) | |
(cd combined/pass-core && git commit --allow-empty -am "Update version to $RELEASE" && git tag --force $RELEASE) | |
(cd combined/pass-support && git commit --allow-empty -am "Update version to $RELEASE" && git tag --force $RELEASE) | |
- name: Release Java modules | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
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: Push Release Docker images to GHCR ~ Java Repositories | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
run: | | |
docker push ghcr.io/eclipse-pass/pass-core-main:$RELEASE | |
docker push ghcr.io/eclipse-pass/deposit-services-core:$RELEASE | |
docker push ghcr.io/eclipse-pass/pass-notification-service:$RELEASE | |
docker push ghcr.io/eclipse-pass/jhu-grant-loader:$RELEASE | |
docker push ghcr.io/eclipse-pass/pass-journal-loader:$RELEASE | |
docker push ghcr.io/eclipse-pass/pass-nihms-loader:$RELEASE | |
- name: Set Snapshot/commit ~ Java Repositories | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
run: | | |
(cd main && mvn versions:set -B -ntp -DallowSnapshots=true -DnewVersion=$NEXT && git commit --allow-empty -am "Update version to $NEXT") | |
(cd combined && mvn versions:set -B -ntp -DallowSnapshots=true -DnewVersion=$NEXT) | |
(cd combined/pass-core && git commit --allow-empty -am "Update version to $NEXT") | |
(cd combined/pass-support && git commit --allow-empty -am "Update version to $NEXT") | |
- name: Release Snapshot Java modules | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
working-directory: combined | |
run: | | |
mvn -B -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: Push Snapshot Docker images to GHCR ~ Java Repositories | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
run: | | |
docker push ghcr.io/eclipse-pass/pass-core-main:$NEXT | |
docker push ghcr.io/eclipse-pass/deposit-services-core:$NEXT | |
docker push ghcr.io/eclipse-pass/pass-notification-service:$NEXT | |
docker push ghcr.io/eclipse-pass/jhu-grant-loader:$NEXT | |
docker push ghcr.io/eclipse-pass/pass-journal-loader:$NEXT | |
docker push ghcr.io/eclipse-pass/pass-nihms-loader:$NEXT | |
- name: Push the commits and tags ~ Java Repositories | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
run: | | |
(cd main && git push --atomic origin main --force $RELEASE) | |
(cd combined/pass-core && git push --atomic origin main --force $RELEASE) | |
(cd combined/pass-support && git push --atomic origin main --force $RELEASE) | |
- name: Create GitHub main release ~ Java Repositories | |
if: ${{ ! env.ALL_JAVA_REPOS_TAG_EXISTS }} | |
run: | | |
gh release delete "$RELEASE" --repo=eclipse-pass/main || true | |
gh release create "$RELEASE" --repo=eclipse-pass/main --generate-notes | |
gh release delete "$RELEASE" --repo=eclipse-pass/pass-core || true | |
gh release create "$RELEASE" --repo=eclipse-pass/pass-core --generate-notes | |
gh release delete "$RELEASE" --repo=eclipse-pass/pass-support || true | |
gh release create "$RELEASE" --repo=eclipse-pass/pass-support --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.JAVA_RELEASE_PAT }} | |
- name: Set Release/commit/tag ~ pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
uses: ./main/.github/actions/yarn-version | |
with: | |
repository_dir: combined/pass-ui | |
env: | |
RELEASE: ${{ env.RELEASE }} | |
- name: Build Release pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
uses: ./main/.github/actions/yarn-build | |
with: | |
repository_dir: combined/pass-ui | |
env_path: ../pass-docker/.env | |
- name: Push Release Docker images to GHCR ~ pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
run: docker push ghcr.io/eclipse-pass/pass-ui:$RELEASE | |
- name: Set Snapshot/commit ~ pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
uses: ./main/.github/actions/yarn-version | |
with: | |
repository_dir: combined/pass-ui | |
skip_tag: "true" | |
env: | |
RELEASE: ${{ env.NEXT }} | |
- name: Build Snapshot pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
uses: ./main/.github/actions/yarn-build | |
with: | |
repository_dir: combined/pass-ui | |
env_path: ../pass-docker/.env | |
is_dev: "true" | |
- name: Push Snapshot Docker images to GHCR ~ pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
run: docker push ghcr.io/eclipse-pass/pass-ui:$NEXT | |
- name: Push the commits and tags ~ pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
run: cd combined/pass-ui && git push --atomic origin main --force $RELEASE | |
- name: Create GitHub main release ~ pass-ui | |
if: ${{ ! env.PASS_UI_TAG_EXISTS }} | |
run: gh release create "$RELEASE" --repo=eclipse-pass/pass-ui --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.JAVA_RELEASE_PAT }} | |
- name: Set Release/commit/tag ~ pass-acceptance-testing | |
if: ${{ ! env.PASS_ACCPT_TEST_TAG_EXISTS }} | |
uses: ./main/.github/actions/yarn-version | |
with: | |
repository_dir: combined/pass-acceptance-testing | |
env: | |
RELEASE: ${{ env.RELEASE }} | |
- name: Set Snapshot/commit ~ pass-acceptance-testing | |
if: ${{ ! env.PASS_ACCPT_TEST_TAG_EXISTS }} | |
uses: ./main/.github/actions/yarn-version | |
with: | |
repository_dir: combined/pass-acceptance-testing | |
skip_tag: "true" | |
env: | |
RELEASE: ${{ env.NEXT }} | |
- name: Push the commits and tags ~ pass-acceptance-testing | |
if: ${{ ! env.PASS_ACCPT_TEST_TAG_EXISTS }} | |
run: cd combined/pass-acceptance-testing && git push --atomic origin main --force $RELEASE | |
- name: Create GitHub main release ~ pass-acceptance-testing | |
if: ${{ ! env.PASS_ACCPT_TEST_TAG_EXISTS }} | |
run: gh release create "$RELEASE" --repo=eclipse-pass/pass-acceptance-testing --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.JAVA_RELEASE_PAT }} | |
- name: Set Release/commit/tag ~ pass-docker | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
run: | | |
cd combined/pass-docker | |
sed -i "/^PASS_VERSION/s/.*/PASS_VERSION=$RELEASE/" .env | |
git commit --allow-empty -am "Update version to $RELEASE" | |
git tag --force $RELEASE | |
- name: Build Release pass-docker images | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
working-directory: combined/pass-docker | |
run: docker compose -f docker-compose.yml -f eclipse-pass.local.yml build idp ldap | |
- name: Push Release Docker images to GHCR ~ pass-docker | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
run: | | |
docker push ghcr.io/eclipse-pass/demo-ldap:$RELEASE | |
docker push ghcr.io/eclipse-pass/idp:$RELEASE | |
- name: Set Snapshot/commit ~ pass-docker | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
run: | | |
cd combined/pass-docker | |
sed -i "/^PASS_VERSION/s/.*/PASS_VERSION=$NEXT/" .env | |
git commit --allow-empty -am "Update version to $NEXT" | |
- name: Build Snapshot pass-docker images | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
working-directory: combined/pass-docker | |
run: docker compose -f docker-compose.yml -f eclipse-pass.local.yml build idp ldap | |
- name: Push Snapshot Docker images to GHCR ~ pass-docker | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
run: | | |
docker push ghcr.io/eclipse-pass/demo-ldap:$NEXT | |
docker push ghcr.io/eclipse-pass/idp:$NEXT | |
- name: Push the commits and tags ~ pass-docker | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
run: cd combined/pass-docker && git push --atomic origin main --force $RELEASE | |
- name: Create GitHub main release ~ pass-docker | |
if: ${{ ! env.PASS_DOCKER_TAG_EXISTS }} | |
run: gh release create "$RELEASE" --repo=eclipse-pass/pass-docker --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.JAVA_RELEASE_PAT }} |