Publish #5165
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 | |
env: | |
JAVA_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server" | |
GRADLE_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server" | |
TERM: xterm-256color | |
REPOSITORY_USER: ${{ secrets.REPOSITORY_USER }} | |
REPOSITORY_PWD: ${{ secrets.REPOSITORY_PWD }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# GRADLE_BUILDCACHE_USER: ci | |
# GRADLE_BUILDCACHE_PSW: ${{ secrets.GRADLE_BUILDCACHE_PSW }} | |
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} | |
GH_PACKAGE_REGISTRY_USER: ${{ secrets.GH_PACKAGE_REGISTRY_USER }} | |
GH_PACKAGE_REGISTRY_TOKEN: ${{ secrets.GH_PACKAGE_REGISTRY_TOKEN }} | |
CAS_MODULE_METADATA_MONGODB_URL: ${{ secrets.CAS_MODULE_METADATA_MONGODB_URL }} | |
JDK_CURRENT: 21 | |
JDK_DISTRIBUTION: "corretto" | |
########################################################################## | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 15 * * *' | |
push: | |
branches: [ master ] | |
concurrency: | |
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}" | |
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'apereo/cas' }} | |
########################################################################## | |
jobs: | |
initialize: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRIBUTION }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Initialize | |
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; && ./ci/init-build.sh | |
########################################################################## | |
publish-snapshots: | |
runs-on: ubuntu-latest | |
needs: [initialize] | |
continue-on-error: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRIBUTION }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Initialize | |
run: find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; && ./ci/init-build.sh | |
- name: Publish SNAPSHOTs | |
if: ${{ env.REPOSITORY_USER != null && env.REPOSITORY_PWD != null }} | |
uses: nick-fields/retry@v3 | |
with: | |
max_attempts: 3 | |
retry_on: error | |
retry_wait_seconds: 10 | |
timeout_minutes: 50 | |
shell: bash | |
command: ./ci/release.sh | |
########################################################################## | |
publish-modules-metadata: | |
runs-on: ubuntu-latest | |
needs: [initialize] | |
continue-on-error: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JDK_CURRENT }} | |
distribution: ${{ env.JDK_DISTRIBUTION }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Initialize | |
run: find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; && ./ci/init-build.sh | |
- name: Install MongoDB tools | |
if: ${{ env.CAS_MODULE_METADATA_MONGODB_URL != null }} | |
run: | | |
wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-7.0.asc | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-mongosh mongodb-database-tools | |
mongosh --version | |
- name: Build Modules Metadata | |
run: | | |
./gradlew generateProjectModulesMetadata --no-configuration-cache \ | |
--build-cache --configure-on-demand --no-daemon \ | |
--parallel -x test -x javadoc -x check | |
- name: Publish Modules Metadata | |
if: ${{ env.CAS_MODULE_METADATA_MONGODB_URL != null }} | |
run: | | |
casVersion=$(cat gradle.properties | grep version | awk -F"=" '{printf $2}') | |
echo "Checking CAS version ${casVersion}..." | |
versionNumbers=${casVersion%%-*} | |
versionNumbers=${versionNumbers//./} | |
echo "CAS simple version number is: $versionNumbers" | |
collectionName="casmodules$versionNumbers" | |
echo "CAS module collection is $collectionName" | |
echo "Uploading module records for ${casVersion} to $collectionName" | |
mongoimport --uri "$CAS_MODULE_METADATA_MONGODB_URL" \ | |
--collection "$collectionName" --file build/modules.json \ | |
--type json --jsonArray --drop 2>/dev/null |