Added option of running a release train for a single project #1
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: Build & Deploy | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Grant execute permission for Gradle | |
run: chmod +x gradlew | |
- name: Build with Gradle without GH acceptance tests | |
env: | |
GH_TOKEN: "" | |
run: ./gradlew build | |
docker: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' # Don't run for PRs | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Login to Docker Hub | |
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin | |
- name: Build with Gradle including acceptance tests | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: ./gradlew build | |
- name: Build and push Docker image with Jib | |
run: ./gradlew jib | |
env: | |
DOCKER_HUB_REPO: "mgrzejszczak/micrometer-release" | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} |