From 3c2746e4c4baa145231ffff017923d25a36b559e Mon Sep 17 00:00:00 2001 From: MiguelPelegrina <95084406+MiguelPelegrina@users.noreply.github.com> Date: Wed, 10 Apr 2024 09:01:12 +0200 Subject: [PATCH] Update ci.yml --- .github/workflows/ci.yml | 77 ++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e2a911..272a7f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,55 +1,38 @@ -name: CI Workflow +name: Docker Image CI on: - push: + push: branches: [ "master" ] - pull_request: + pull_request: branches: [ "master" ] - workflow_dispatch: + workflow_dispatch: jobs: - build: + build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: npm install and npm run CI commands - run: | - npm i - npm run test - npm run build - - - name: Build the Docker image - run: docker build . --file Dockerfile - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v1 - with: - images: migupele/java_school_online_store_frontend - - - name: Build and push Docker image - uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 - with: - context: . - file: ./Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v1 + with: + images: migupele/java_school_online_store_frontend + + - name: Build and push Docker image + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}