Skip to content

Commit

Permalink
Merge pull request #48 from Pablo1618/Pipeline-v2
Browse files Browse the repository at this point in the history
Pipeline v2
  • Loading branch information
DexuCom authored Jan 13, 2025
2 parents a5d8e47 + c86686f commit 8619ac6
Showing 1 changed file with 4 additions and 88 deletions.
92 changes: 4 additions & 88 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@ on:
branches:
- main
- master
pull_request:
types: [closed]
branches:
- main
- master

jobs:
build:
build_adn_push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -26,86 +21,7 @@ jobs:
IMAGE_NAME: geekup-prestashop
DOCKERFILE_PATH: ./configuration/Dockerfile
run: |
docker build -t $IMAGE_NAME:1.0 -f $DOCKERFILE_PATH .
- name: Save Docker image as a file
env:
IMAGE_NAME: geekup-prestashop
run: |
docker save $IMAGE_NAME:1.0 -o image.tar
- name: Upload Docker image artifact
uses: actions/upload-artifact@v3
with:
name: docker-image
path: image.tar

test:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Download Docker image artifact
uses: actions/download-artifact@v3
with:
name: docker-image

- name: Load Docker image
run: |
docker load -i image.tar
- name: Tag image for Docker Compose
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME: geekup-prestashop
run: |
docker tag $IMAGE_NAME:1.0 $DOCKERHUB_USERNAME/$IMAGE_NAME:1.4
- name: Start PrestaShop environment
run: |
docker-compose -f docker-compose.dev.yml up -d
- name: Setup Google Chrome
uses: browser-actions/setup-chrome@v1

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Install Maven
run: |
sudo apt-get update
sudo apt-get install -y maven
- name: Build and run Java app
run: |
mvn clean install
push:
runs-on: ubuntu-latest
needs:
- build
- test
steps:
- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Download Docker image artifact
uses: actions/download-artifact@v3
with:
name: docker-image

- name: Load Docker image
run: |
docker load -i image.tar
docker build -t $IMAGE_NAME:latest -f $DOCKERFILE_PATH .
- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -118,5 +34,5 @@ jobs:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_NAME: geekup-prestashop
run: |
docker tag $IMAGE_NAME:1.0 $DOCKERHUB_USERNAME/$IMAGE_NAME:1.0
docker push $DOCKERHUB_USERNAME/$IMAGE_NAME:1.0
docker tag $IMAGE_NAME:latest $DOCKERHUB_USERNAME/$IMAGE_NAME:latest
docker push $DOCKERHUB_USERNAME/$IMAGE_NAME:latest

0 comments on commit 8619ac6

Please sign in to comment.