|
| 1 | +name: Dev Workflow |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - dev |
| 6 | + |
| 7 | +env: |
| 8 | + CARGO_TERM_COLOR: always |
| 9 | + ACTOR: ${{ github.actor }} |
| 10 | + REPOSITORY: ${{ github.repository }} |
| 11 | + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} |
| 12 | + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - name: Build |
| 21 | + run: cargo build --verbose |
| 22 | + |
| 23 | + - name: Build Docker images |
| 24 | + run: | |
| 25 | + docker compose build |
| 26 | +
|
| 27 | + test: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - name: Testing |
| 33 | + run: | |
| 34 | + cargo test --verbose |
| 35 | +
|
| 36 | + deploy: |
| 37 | + needs: [test] |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Login to Docker Hub |
| 42 | + uses: docker/login-action@v3 |
| 43 | + with: |
| 44 | + username: ${{ vars.DOCKERHUB_USERNAME }} |
| 45 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 46 | + |
| 47 | + - name: Build and push |
| 48 | + uses: docker/build-push-action@v6 |
| 49 | + with: |
| 50 | + file: ./compose/.development/backend/Dockerfile |
| 51 | + context: . |
| 52 | + push: true |
| 53 | + tags: wrldengine/rust_actix_boilerplate:latest |
| 54 | + |
| 55 | + notify_email: |
| 56 | + needs: [deploy] |
| 57 | + runs-on: ubuntu-latest |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Install sendmail |
| 61 | + run: sudo apt update && sudo apt install -y sendmail postfix |
| 62 | + |
| 63 | + - uses: actions/checkout@v2 |
| 64 | + - name: Notify By Email |
| 65 | + run: | |
| 66 | + chmod +x ./scripts/email_notify.sh |
| 67 | + bash ./scripts/email_notify.sh |
| 68 | + env: |
| 69 | + NOTIFY_SMTP_SERVER: ${{ secrets.NOTIFY_SMTP_SERVER }} |
| 70 | + NOTIFY_SMTP_PORT: ${{ secrets.NOTIFY_SMTP_PORT }} |
| 71 | + NOTIFY_SMTP_PASSWORD: ${{ secrets.NOTIFY_SMTP_PASSWORD }} |
| 72 | + NOTIFY_SMTP_USER: ${{ secrets.NOTIFY_SMTP_USER }} |
| 73 | + NOTIFY_SMTP_TO: ${{ secrets.NOTIFY_SMTP_TO }} |
| 74 | + |
| 75 | + |
| 76 | + notify_telegram: |
| 77 | + needs: [deploy] |
| 78 | + runs-on: ubuntu-latest |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v2 |
| 82 | + - name: Notify By Telegram bot |
| 83 | + run: | |
| 84 | + chmod +x ./scripts/telegram_notify.sh |
| 85 | + bash ./scripts/telegram_notify.sh |
| 86 | + env: |
| 87 | + CICD_BOT_TOKEN: ${{ secrets.CICD_BOT_TOKEN }} |
| 88 | + CICD_GROUP: ${{ secrets.CICD_GROUP }} |
| 89 | + ACTOR: ${{ github.actor }} |
| 90 | + REPOSITORY: ${{ github.repository }} |
| 91 | + GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} |
| 92 | + GITHUB_SHA: ${{ github.sha }} |
| 93 | + RUN_ID: ${{ github.run_id }} |
| 94 | + DEPLOY_RESULT: ${{ needs.deploy.result }} |
0 commit comments