Skip to content

Commit

Permalink
resolve ci-cd docker login username
Browse files Browse the repository at this point in the history
  • Loading branch information
deyvisonborges committed Apr 22, 2024
1 parent 0b8d5c3 commit 36c898a
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Source Code Checkout
uses: actions/checkout@v4
uses: actions/checkout@v2

- name: JDK Configure
uses: actions/setup-java@v4
uses: actions/setup-java@v2
with:
java-version: "17"
distribution: "temurin"
Expand All @@ -35,29 +35,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Build with Gradle Wrapper
run: gradle build
with:
arguments: clean build -x test
run: ./gradlew clean build -x test

- name: Set build tag
run: |
echo BUILD_TAG=$(echo ${{ github.head_ref || github.ref_name }} | sed "s,/,_,g")-${{ github.run_number }} >> $GITHUB_ENV
run: echo "BUILD_TAG=$(echo ${{ github.head_ref || github.ref }} | sed 's,/,_,g')-${{ github.run_number }}" >> $GITHUB_ENV

- name: Print BUILD_TAG
run: |
echo "Branch ---> ${{ github.head_ref || github.ref_name }}"
echo "Tag ---> $BUILD_TAG"
run: echo "Branch ---> ${{ github.head_ref || github.ref }}" && echo "Tag ---> ${{ env.BUILD_TAG }}"

- name: Login to DockerHub
uses: docker/login-action@v2
Expand All @@ -66,9 +60,9 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v2
with:
context: .
push: true
build-args: VERSION=${{ env.BUILD_TAG }}
tags: ${{ env.IMAGE_NAME }}:${{ env.BUILD_TAG }}
tags: deyvisonborges/${{ env.IMAGE_NAME }}:${{ env.BUILD_TAG }}

0 comments on commit 36c898a

Please sign in to comment.