Skip to content

Commit

Permalink
Update actions to use JDK 21
Browse files Browse the repository at this point in the history
  • Loading branch information
anuruddhal committed Nov 13, 2024
1 parent a7ee4a3 commit df510b6
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 63 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17.0.7
distribution: "adopt"
java-version: 21
distribution: "temurin"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
113 changes: 73 additions & 40 deletions .github/workflows/generate-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ jobs:

build-jre-docker:
needs: pre-validate-registry-sync
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.tag-gen.outputs.TAG }}
MAJ_MIN_TAG: ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
MAJ_TAG: ${{ steps.tag-gen.outputs.MAJ_TAG }}
GENERATE_ONLY_ONE_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_ONE_TAG }}
GENERATE_ONLY_TWO_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_TWO_TAG }}
GENERATE_ONLY_THREE_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_THREE_TAG }}
GENERATE_ONLY_FOUR_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_FOUR_TAG }}
DOCKER_HUB_NAME: ${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}
steps:
- name: Checkout branch
uses: actions/checkout@v3
Expand Down Expand Up @@ -194,80 +200,107 @@ jobs:
echo ::set-output name=DOCKER_HUB_NAME::$docker_hub_name
id: tag-gen
push-images:
needs: build-jre-docker
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout branch
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.BAL_DOCKER_HUB_USERNAME }}
password: ${{ secrets.BAL_DOCKER_HUB_ACCESS_TOKEN }}

- name: Login to ACR
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_ACR_NAME }}.azurecr.io
username: ${{ secrets.DOCKER_ACR_USERNAME }}
password: ${{ secrets.DOCKER_ACR_PASSWORD }}
- name: Build and push only major.minor.patch tag
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_ONE_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_ONE_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
- name: Build and push only major.minor.patch, major.minor
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_TWO_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_TWO_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
- name: Build and push only major.minor.patch, major.minor, major
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_THREE_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_THREE_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
- name: Build and push only major.minor.patch, major.minor, major, latest
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_FOUR_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_FOUR_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:latest
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:latest
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:latest
- name: Send Notifications
run: |
tags=""
if [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_ONE_TAG }} == 1 ]]
if [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_ONE_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch)"
elif [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_TWO_TAG }} == 1 ]]
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch)"
elif [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_TWO_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch), ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }} (minor)"
elif [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_THREE_TAG }} == 1 ]]
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch), ${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }} (minor)"
elif [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_THREE_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch), ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }} (minor), ${{ steps.tag-gen.outputs.MAJ_TAG }} (major)"
elif [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_FOUR_TAG }} == 1 ]]
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch), ${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }} (minor), ${{ needs.build-jre-docker.outputs.MAJ_TAG }} (major)"
elif [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_FOUR_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch), ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }} (minor), ${{ steps.tag-gen.outputs.MAJ_TAG }} (major), latest"
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch), ${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }} (minor), ${{ needs.build-jre-docker.outputs.MAJ_TAG }} (major), latest"
else
tags="no tags has been updated"
tags="no tags have been updated"
fi
docker run -e SPACE_ID="${{ secrets.SPACE_ID }}" -e MESSAGE_KEY="${{ secrets.MESSAGE_KEY }}" -e CHAT_TOKEN="${{ secrets.CHAT_TOKEN }}" -e TAGS="${tags}" ballerina/base_image_update_notifications
post-validate-registry-sync:
needs: build-jre-docker
uses: ./.github/workflows/validate-registry-sync.yml
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Set version env variable
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV
- name : Pre release depenency version update
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17.0.7
distribution: 'adopt'
java-version: 21
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Code2cloud extension implementation for ballerina.

## How to build

1. Download and install JDK 17
1. Download and install JDK 21
1. Export github personal access token & user name as environment variables.
```bash
export packagePAT=<Token>
export packageUser=<username>
```
1. (optional) Specify the Java home path for JDK 17 ie;
1. (optional) Specify the Java home path for JDK 21 ie;
```bash
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-17.jdk/Contents/Home/
export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
```
1. Install Docker
1. Get a clone or download the source from this repository (https://github.com/ballerina-platform/module-ballerina-c2c)
Expand Down

0 comments on commit df510b6

Please sign in to comment.