junhao/CICD Workflow #13
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
name: CI Pipeline | |
on: | |
pull_request: | |
branches: | |
- staging | |
- main | |
jobs: | |
test-and-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Make envfile | |
uses: SpicyPizza/create-envfile@v2.0 | |
with: | |
DOCKERHUB_REPO: jjlim159 | |
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} | |
POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
POSTGRES_MULTIPLE_DATABASES: users,tournaments,matchmaking,elo-ranking | |
POSTGRES_URL: jdbc:postgresql://${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/${{ secrets.POSTGRES_DB }} | |
SPRING_PROFILES_ACTIVE: docker | |
- name: Move .env file to backend directory | |
run: mv .env backend/.env | |
- name: Downloading of docker-compose | |
uses: KengoTODA/actions-setup-docker-compose@v1 | |
with: | |
version: '2.14.2' | |
- name: Build and push Docker images with Docker Compose | |
run: | | |
docker-compose -f backend/docker-compose.yml build |