Merge pull request #3 from rahulpandey70:ci-cd #1
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: Build and Deploy | ||
on: | ||
push: | ||
branches: [master] | ||
env: PORT:${{secrets.PORT}} | ||
MONGODB_URL:${{secrets.MONGODB_URL}} | ||
NODE_ENV:${{secrets.NODE_ENV}} | ||
ACCESS_TOKEN_SECRET:${{secrets.ACCESS_TOKEN_SECRET}} | ||
REFRESH_TOKEN_SECRET:${{secrets.REFRESH_TOKEN_SECRET}} | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install | ||
working-directory: ./frontend | ||
run: | | ||
npm install | ||
- name: Install | ||
working-directory: . | ||
run: | | ||
npm install | ||
export PORT=$PORT | ||
export MONGODB_URL=$MONGODB_URL | ||
export NODE_ENV=$NODE_ENV | ||
export ACCESS_TOKEN_SECRET=$ACCESS_TOKEN_SECRET | ||
export REFRESH_TOKEN_SECRET=$REFRESH_TOKEN_SECRET | ||
- name: Build Client Docker Image | ||
working-directory: ./frontend | ||
run: docker build -t rahulpandey9103/social-media-app:frontend-${{github.run_number}} . | ||
- name: Build Server Docker Image | ||
working-directory: . | ||
run: docker build -t rahulpandey9103/social-media-app:server-${{github.run_number}} . | ||
- name: Login to Docker Hub | ||
uses: docker/login-actions@v3 | ||
with: username:${{serects.DOCKER_USERNAME}} | ||
Check failure on line 45 in .github/workflows/pipeline.yml GitHub Actions / Build and DeployInvalid workflow file
|
||
password:${{secrets.DOCKER_PASSWORD}} | ||
- name: Push the docker images to Docker Hub | ||
run: | | ||
docker push rahulpandey9103/social-media-app:frontend-${{github.run_number}} | ||
docker push rahulpandey9103/social-media-app:server-${{github.run_number}} |