Merge pull request #12 from Ankit-clouddrove/prod #20
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: Setup-Nginx | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
branches: | |
- [feature1, prod] | |
build: | |
# if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Build Docker Image | |
run: echo "Build successful" | |
test: | |
# if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Run Basic Tests | |
run: echo "Tests successful!" | |
deploy: | |
# if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
needs: [build,test] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Deploy to ECR | |
run: echo "Deploy to Amazon ECR" | |
setup-nginx: | |
# if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
env: | |
USER_NAME: ${{ secrets.USER_NAME }} | |
USER_PASSWORD: ${{ secrets.USER_PASSWORD }} | |
needs: [build,test,deploy] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: print name | |
run: | | |
echo "USER_NAME=${USER_NAME}" | |
echo "USER_PASSWORD=${USER_PASSWORD}" | |
- name: Create and Navigate to Directory | |
run: | | |
mkdir github-action-nginx | |
cd github-action-nginx | |
touch code.html | |
- name: Update and Upgrade | |
run: sudo apt-get update && sudo apt-get upgrade -y | |
- name: Install Nginx | |
run: sudo apt-get install nginx -y | |
- name: Start Nginx | |
run: sudo service nginx start | |
- name: staus nginx | |
run: sudo systemctl status nginx | |