Update main.yml #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# main.yaml | |
name: Build, Test, and Seed Data | |
on: | |
push: | |
branches: ['main'] | |
jobs: | |
test_and_seed_data: | |
name: Run Jest Tests and Seed Data | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Run Jest Tests | |
run: | | |
docker-compose -f docker-compose.dependencies.yaml -f docker-compose.app.yaml run --rm app npm test | |
- name: Seed Data into Clever Cloud Database | |
run: | | |
docker-compose -f docker-compose.dependencies.yaml -f docker-compose.app.yaml run --rm app npx sequelize-cli db:seed:all | |
- name: Import Data into Clever Cloud Database | |
run: | | |
# Optionally, perform any other necessary steps after seeding if needed | |
# ... | |
env: | |
CLEVER_CLOUD_DB_HOST: ${{ secrets.CLEVER_CLOUD_DB_HOST }} | |
CLEVER_CLOUD_DB_USER: ${{ secrets.CLEVER_CLOUD_DB_USER }} | |
CLEVER_CLOUD_DB_PASSWORD: ${{ secrets.CLEVER_CLOUD_DB_PASSWORD }} | |
CLEVER_CLOUD_DB_NAME: ${{ secrets.CLEVER_CLOUD_DB_NAME }} | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
needs: test_and_seed_data | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: atallah0/backend-final-4-app | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |