Skip to content

Commit

Permalink
fixing ci-booking
Browse files Browse the repository at this point in the history
  • Loading branch information
vondacho committed Jun 8, 2024
1 parent c8319b9 commit 0841ed8
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions .github/workflows/ci-booking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ jobs:
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
cache-dependency-path: '${{ env.MODULE_NAME }}/pom.xml'

- name: Build with Maven
run: mvn -B package --file ${{ env.MODULE_NAME }}/pom.xml
Expand All @@ -44,38 +43,30 @@ jobs:

- name: Log in to the Container registry
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '${{ env.MODULE_NAME }}')
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Sanitize tag name
uses: actions/github-script@v6
uses: actions/github-script@v7
id: sanitized_tag
with:
result-encoding: string
script: return '${{ github.ref }}'.replace('refs/tags/', '').replace('-${{ env.MODULE_NAME }}', '').trim()

- name: Extract metadata (tags, labels) for Docker
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '${{ env.MODULE_NAME }}')
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
tags: |
latest
${{ steps.sanitized_tag.outputs.result }}
- name: Build and push Docker image
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '${{ env.MODULE_NAME }}')
uses: docker/build-push-action@v4
id: push
uses: docker/build-push-action@v5
with:
context: '/home/runner/work/pt-agency/pt-agency/${{ env.MODULE_NAME }}'
file: '${{ env.MODULE_NAME }}/src/main/docker/Dockerfile.jvm'
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:latest
${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ steps.sanitized_tag.outputs.result }}
- name: Generate artifact attestation
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '${{ env.MODULE_NAME }}')
Expand Down

0 comments on commit 0841ed8

Please sign in to comment.