Skip to content

github secrets

github secrets #3

Workflow file for this run

name: CICD
on:
push:
branches:
- cicd
jobs:
publish:
runs-on:
ubuntu-latest
steps:
## Step 1: Configuration
- uses: actions/checkout@v3
- uses: s4u/[email protected]
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- uses: browser-actions/setup-chrome@latest
- run: chrome --versión
## Step 2: Docker Login and Image Build
- name: Login to docker
run: docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}"
- name: Build the docker image
run: docker build -f Docker/Dockerfile -t ${{ secrets.DOCKERHUB_IMAGE }}:${{ github.sha }} .
## Step 3: Image Execution and Wait to Image Start
- name: Setup docker compose
run: docker-compose up -d
- name: Give permissions to wait containers start script
run: chmod +x waitContainer.sh
- name: Wait for containers to start
run: ./waitContainer.sh
## Step 4: Test execution
- name: Run tests
run: mvn clean test -Dtest=LoginUiTests.java
## Step 5: End Image Execution and Push image to Docker Hub
- name: Stop docker compose
run: docker-compose down
- name: Push the docker image
run: docker push ${{ secrets.DOCKERHUB_IMAGE }}:${{ github.sha }}
- name: Push the docker image
run: docker push ${{ secrets.DOCKERHUB_IMAGE }}:${{ github.sha }}