Merge pull request #2 from CODESPACE-CE-PROJECT/CE-008-Compiler #13
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: Deployment | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| branches: ['dev'] | |
| jobs: | |
| sonarqube: | |
| runs-on: self-hosted | |
| if: github.event_name == 'pull_request' | |
| name: Build and Analyze | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: sonarsource/sonarqube-scan-action@master | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
| deploy: | |
| runs-on: self-hosted | |
| if: github.event_name == 'push' | |
| steps: | |
| - name: Clone Repo 🤖 | |
| uses: actions/checkout@v3 | |
| - name: Set Environment Variables 🔠 | |
| env: | |
| PORT: ${{ secrets.PORT }} | |
| RMQUSER: ${{ secrets.RMQUSER }} | |
| RMQPASS: ${{ secrets.RMQPASS }} | |
| RMQHOST: ${{ secrets.RMQHOST }} | |
| RMQNAME: ${{ secrets.RMQNAME }} | |
| BACKEND_URL: ${{ secrets.BACKEND_URL }} | |
| JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
| run: | | |
| echo "PORT=$PORT" >> .env | |
| echo "JWT_SECRET=$JWT_SECRET" >> .env | |
| echo "RMQUSER=$RMQUSER" >> .env | |
| echo "RMQPASS=$RMQPASS" >> .env | |
| echo "RMQHOST=$RMQHOST" >> .env | |
| echo "RMQNAME=$RMQNAME" >> .env | |
| echo "BACKEND_URL=$BACKEND_URL" >> .env | |
| - name: Clear Cache 🫧 | |
| run: | | |
| docker stop compiler || true | |
| docker rm compiler || true | |
| docker rmi compiler-compiler:latest || true | |
| - name: Run Image ✅ | |
| run: | | |
| docker compose up -d | |
| - name: Message ✉️ | |
| uses: fjogeleit/http-request-action@v1 | |
| with: | |
| timeout: 60000 | |
| url: ${{ secrets.DISCORD_WEBHOOK }} | |
| method: 'POST' | |
| customHeaders: '{"Content-Type": "application/json"}' | |
| data: '{"content": "CE PROJECT Compiler Build ✅","embeds": [{"title": "Backend url","description": "codespace-compiler.srv-demo-2.home.unixvextor.com"}]}' |