Public Youmubot system, modular (I hope!) and safe and fast...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.9KB

  1. name: Deploy
  2. on:
  3. push:
  4. branches: [ master ]
  5. jobs:
  6. build:
  7. name: Build a Release Binary
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v2
  11. - uses: actions-rs/toolchain@v1
  12. with:
  13. toolchain: stable
  14. - uses: actions/cache@v2
  15. with:
  16. path: |
  17. ~/.cargo/registry
  18. ~/.cargo/git
  19. target
  20. key: ${{ runner.os }}-rust-release-${{ hashFiles('**/Cargo.lock') }}
  21. - name: Build release
  22. run: cargo build --release
  23. - name: Upload compiled binary artifact
  24. uses: actions/upload-artifact@v1
  25. with:
  26. name: youmubot-release
  27. path: target/release/youmubot
  28. deploy:
  29. name: Deploy to remote
  30. needs: build
  31. runs-on: ubuntu-latest
  32. steps:
  33. - name: Collect artifact
  34. uses: actions/download-artifact@v1
  35. with:
  36. name: youmubot-release
  37. - name: Upload binary
  38. uses: appleboy/scp-action@master
  39. with:
  40. host: ${{ secrets.HOST }}
  41. username: ${{ secrets.USERNAME }}
  42. key: ${{ secrets.SSH_KEY }}
  43. port: ${{ secrets.PORT }}
  44. source: youmubot-release/youmubot
  45. target: youmubot
  46. strip_components: 1
  47. - name: Restart youmubot
  48. uses: appleboy/ssh-action@master
  49. with:
  50. host: ${{ secrets.HOST }}
  51. username: ${{ secrets.USERNAME }}
  52. key: ${{ secrets.SSH_KEY }}
  53. port: ${{ secrets.PORT }}
  54. script: |
  55. chmod +x youmubot/youmubot
  56. systemctl --user restart youmubot