# GitHub Actions — Dynamic Level Deploy # Auto-generated by hmcmkit /pdca deploy # Docker Build + Push + Deploy name: Deploy on: push: branches: [main, develop, 'release/**'] pull_request: branches: [main] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: test-and-lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - run: npm ci - run: npm run lint - run: npm test security-scan: runs-on: ubuntu-latest needs: test-and-lint steps: - uses: actions/checkout@v4 - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: scan-type: 'fs' scan-ref: '.' severity: 'CRITICAL,HIGH' exit-code: '1' build-and-push: runs-on: ubuntu-latest needs: [test-and-lint, security-scan] permissions: contents: read packages: write steps: - uses: actions/checkout@v4 - uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/build-push-action@v5 with: context: . push: true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest deploy-dev: if: github.ref == 'refs/heads/develop' runs-on: ubuntu-latest needs: build-and-push environment: development steps: - uses: actions/checkout@v4 - name: Deploy to DEV (Docker Compose) run: | echo "Deploying to DEV environment" # docker compose -f docker-compose.yml up -d deploy-staging: if: startsWith(github.ref, 'refs/heads/release/') runs-on: ubuntu-latest needs: build-and-push environment: staging steps: - uses: actions/checkout@v4 - name: Deploy to STAGING run: | echo "Deploying to STAGING environment" # Add staging deploy commands