Create k #42
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 | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- uses: sonarsource/sonarqube-scan-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
- name: NPM Install | |
run: npm install | |
# Use the personal access token to access repositories | |
- name: Push changes to another repository | |
env: | |
PAT: ${{ secrets.GIT_TOKEN }} # You need to add this secret to your repository | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git add . | |
git commit -m "Automated build" | |
git push https://$GITHUB_ACTOR:${{ secrets.PAT }}@github.com/Aakibgithuber/deployment-using-github-actions.git HEAD:master | |
- name: Docker build and push | |
run: | | |
# Run commands to build and push Docker images | |
docker build -t swiggy-clone . | |
docker tag swiggy-clone aakibkhan1212/swiggy-clone:latest | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker push aakibkhan1212/swiggy-clone:latest | |
env: | |
DOCKER_CLI_ACI: 1 |