Skip to content

Commit

Permalink
refs #109: Update release config
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciogeneroso committed Jun 29, 2024
1 parent f932c51 commit 3584715
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/sd-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: 'groot-mg/release/service-discovery'

jobs:
build-and-release:
Expand All @@ -35,15 +35,15 @@ jobs:
- name: Build
run: ./gradlew :sd-app:build -x test

- name: Generate release version
run: ./gradlew :sd-app:release

- name: Upload JAR
uses: actions/upload-artifact@v4
with:
name: app-jar
path: sd-app/build/libs/service-discovery.jar

- name: Release
run: ./gradlew :sd-app:release

publish-docker-image:
needs: build-and-release
runs-on: ubuntu-latest
Expand All @@ -53,16 +53,22 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Download JAR
uses: actions/download-artifact@v4
with:
name: app-jar
path: sd-app/build/libs/

- name: Get version from tag
- name: Get version
id: get_version
run: |
VERSION=$(git describe --tags --abbrev=0)
VERSION=$(./gradlew sd-app:currentVersion -q --console=plain | grep -oP '(?<=Project version: )[\d\.]+')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Log in to the Container registry
Expand All @@ -78,13 +84,13 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,prefix=v,pattern={{raw}},value=${{ env.VERSION }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: sd-app/
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion sd-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ java {
}

scmVersion {
tag { prefix = rootProject.name + '-' }
tag { prefix = 'v' }
versionIncrementer 'incrementMinor'
}
project.version = scmVersion.version
Expand Down

0 comments on commit 3584715

Please sign in to comment.