From dfe57add9d19dd031ca7ffe17bf5186ea7cbeb14 Mon Sep 17 00:00:00 2001 From: Harsh Verma <55652117+Harsh3305@users.noreply.github.com> Date: Wed, 18 Jan 2023 23:15:00 +0530 Subject: [PATCH] Update docker_image.yml (#24) --- .github/workflows/docker_image.yml | 36 +++++++++--------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/.github/workflows/docker_image.yml b/.github/workflows/docker_image.yml index e2268f0..cb3e711 100644 --- a/.github/workflows/docker_image.yml +++ b/.github/workflows/docker_image.yml @@ -11,7 +11,7 @@ name: Publish Docker image on: release: - types: [published] + types: [published] env: MONGODB_URI: ${{ secrets.MONGODB_URI }} @@ -22,38 +22,23 @@ jobs: permissions: packages: write contents: read - if: "!contains(github.event.head_commit.message, 'ci skip')" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Cache Gradle packages - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - name: Build with Gradle - run: gradle clean build + - name: Check out the repo + uses: actions/checkout@v3 + - name: Log in to Docker Hub uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - + - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 @@ -61,13 +46,12 @@ jobs: images: | harsh3305/hrv-mart-backend-user ghcr.io/${{ github.repository }} - - uses: actions/checkout@v2 - - name: Set up JDK 17 + - name: Set up Java version uses: actions/setup-java@v1 with: - java-version: 17 - - name: Grant execute permission for gradlew - run: chmod +x gradlew + java-version: '17' + - name: Build with Gradle + run: gradle clean build - name: Build and push Docker images uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: