|
41 | 41 | with:
|
42 | 42 | languages: python
|
43 | 43 |
|
44 |
| - - name: Perform CodeQL Analysis |
| 44 | + - name: Perform CodeQL analysis |
45 | 45 | uses: github/codeql-action/analyze@v3
|
46 | 46 | with:
|
47 | 47 | category: '/language:python'
|
| 48 | + |
| 49 | + build-docker-images: |
| 50 | + environment: staging |
| 51 | + name: Build Docker Images |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: |
| 54 | + - pre-commit |
| 55 | + steps: |
| 56 | + - name: Check out repository |
| 57 | + uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Set up QEMU |
| 60 | + uses: docker/setup-qemu-action@v3 |
| 61 | + |
| 62 | + - name: Set up Docker buildx |
| 63 | + uses: docker/setup-buildx-action@v3 |
| 64 | + |
| 65 | + - name: Login to Docker Hub |
| 66 | + uses: docker/login-action@v3 |
| 67 | + with: |
| 68 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 69 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 70 | + |
| 71 | + - name: Build backend image |
| 72 | + uses: docker/build-push-action@v6 |
| 73 | + with: |
| 74 | + context: backend |
| 75 | + file: backend/Dockerfile.staging |
| 76 | + platforms: linux/amd64 |
| 77 | + push: true |
| 78 | + tags: ${{ secrets.DOCKERHUB_USERNAME }}/owasp-nest-backend:latest |
| 79 | + |
| 80 | + deploy: |
| 81 | + environment: staging |
| 82 | + name: Deploy Nest Staging |
| 83 | + env: |
| 84 | + STAGING_SSH_PRIVATE_KEY_PATH: ~/.ssh/nest_staging_private_key |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: |
| 87 | + - build-docker-images |
| 88 | + steps: |
| 89 | + - name: Check out repository |
| 90 | + uses: actions/checkout@v4 |
| 91 | + |
| 92 | + - name: Prepare SSH key |
| 93 | + run: | |
| 94 | + mkdir -m 700 ~/.ssh |
| 95 | + echo "${{ secrets.STAGING_SSH_PRIVATE_KEY }}" > "${{ env.STAGING_SSH_PRIVATE_KEY_PATH}}" |
| 96 | + chmod 400 "${{ env.STAGING_SSH_PRIVATE_KEY_PATH}}" |
| 97 | +
|
| 98 | + - name: Run Nest deploy |
| 99 | + working-directory: .github/deploy |
| 100 | + run: ansible-playbook -i inventory.yaml staging.yaml |
0 commit comments