feat: implement credit system and agent-based code generation pipelin… #18
This file contains hidden or 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] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "rollback sha code" | |
| required: false | |
| type: string | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push | |
| if: github.event.inputs.tag == '' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ghcr.io/tejabudumuru3/codeplay:latest | |
| ghcr.io/tejabudumuru3/codeplay:${{ github.sha }} | |
| - name: Deploy to machine | |
| uses: appleboy/ssh-action@v1 | |
| env: | |
| DEPLOY_TAG: ${{ github.event.inputs.tag || github.sha }} | |
| with: | |
| host: ${{ secrets.ORACLE_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.ORACLE_SSH_KEY }} | |
| envs: DEPLOY_TAG | |
| script: | | |
| docker login ghcr.io -u TejaBudumuru3 -p ${{ secrets.GHCR_PAT }} | |
| docker pull ghcr.io/tejabudumuru3/codeplay:$DEPLOY_TAG | |
| docker stop codeplay || true | |
| docker rm codeplay || true | |
| docker run -d \ | |
| --name codeplay \ | |
| --restart always \ | |
| -p 3000:3000 \ | |
| --env-file /home/ubuntu/.env \ | |
| ghcr.io/tejabudumuru3/codeplay:$DEPLOY_TAG | |
| docker image prune -f |