Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require projects specify Java version in .tool-versions so we build with that version, use Java 21 LTS elsewhere #31

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/reusable-release.yml
Expand Up @@ -10,6 +10,11 @@ on:
default: '807361' # Only for use by the Guardian!
required: false # ...but if you're not the Guardian, you'll want to set this explicitly
type: string
LIBRARY_BUILD_JAVA_VERSION_FILE:
description: "Path within the repo to the java-version-file - see https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#java-version-file"
default: '.tool-versions' # as used by https://asdf-vm.com/
required: false
type: string
SONATYPE_PROFILE_NAME:
description: 'Sonatype account profile name, eg "com.gu", "org.xerial", etc (not your Sonatype username)'
default: 'com.gu' # Only for use by the Guardian!
Expand Down Expand Up @@ -54,6 +59,7 @@ env:
RUN_ATTEMPT_UID: ${{ github.run_id }}-${{ github.run_attempt }}
TEMPORARY_BRANCH: release-workflow/temporary/${{ github.run_id }}
GITHUB_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
LATEST_LTS_JAVA_VERSION: '21' # Used by all parts of the workflow that are not invoking the library's build process

jobs:
init:
Expand All @@ -68,7 +74,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
gpg-private-key: ${{ secrets.PGP_PRIVATE_KEY }}
- name: Read Identifiers from Signing Key
id: read-identifiers
Expand Down Expand Up @@ -115,7 +121,7 @@ jobs:
- uses: actions/setup-java@v4 # don't 'cache: sbt', at least until https://github.com/actions/setup-java/pull/564 is merged
with:
distribution: corretto
java-version: 17
java-version-file: ${{ inputs.LIBRARY_BUILD_JAVA_VERSION_FILE }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we run the library's build process, let's respect the .tools-version that they supply - see actions/setup-java#606

# - name: Debug MIMA assessment
# run: |
# sbt "show versionPolicyFindIssues"
Expand Down Expand Up @@ -176,7 +182,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
gpg-private-key: ${{ secrets.PGP_PRIVATE_KEY }}
- name: Create commit
id: create-commit
Expand Down Expand Up @@ -250,7 +256,7 @@ jobs:
- uses: actions/setup-java@v4 # don't 'cache: sbt', at least until https://github.com/actions/setup-java/pull/564 is resolved
with:
distribution: corretto
java-version: 17
java-version-file: ${{ inputs.LIBRARY_BUILD_JAVA_VERSION_FILE }}
- name: Generate artifacts
run: |
cat << EndOfFile > sbt-commands.txt
Expand Down Expand Up @@ -305,7 +311,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
gpg-private-key: ${{ secrets.PGP_PRIVATE_KEY }}
- name: Sign artifacts
run: |
Expand Down Expand Up @@ -377,7 +383,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
java-version: ${{ env.LATEST_LTS_JAVA_VERSION }}
cache: sbt # the issue described in https://github.com/actions/setup-java/pull/564 doesn't affect this step (no version.sbt)
- name: Release
env:
Expand Down