main.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: Deploy
  2. on:
  3. push:
  4. branches:
  5. - deploy
  6. jobs:
  7. build:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v3
  12. with:
  13. path: webs
  14. - name: Checkout meta2d.js repo
  15. uses: actions/checkout@v3
  16. with:
  17. repository: le5le-com/meta2d.js
  18. path: meta2d.js
  19. - name: Checkout 2d-components repo
  20. uses: actions/checkout@v3
  21. with:
  22. repository: le5le-com/2d-components
  23. token: ${{ secrets.PAT }}
  24. path: 2d-components
  25. - name: Install core
  26. run: |
  27. cd meta2d.js
  28. yarn
  29. - uses: pnpm/action-setup@v2
  30. with:
  31. version: latest
  32. - name: Build
  33. run: |
  34. cd webs
  35. pnpm i && pnpm build
  36. - name: 安装COS
  37. run: |
  38. sudo pip install coscmd
  39. - name: 配置COS
  40. env:
  41. SECRET_ID: ${{ secrets.SECRET_ID }}
  42. SECRET_KEY: ${{ secrets.SECRET_KEY }}
  43. BUCKET: ${{ secrets.BUCKET }}
  44. REGION: ${{ secrets.COS_REGION }}
  45. run: |
  46. coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION
  47. - name: Upload COS
  48. run: |
  49. coscmd upload -rfs ./webs/v/ /v/
  50. - name: Upload index.html
  51. uses: appleboy/scp-action@v0.1.4
  52. with:
  53. host: ${{ secrets.HOST }}
  54. username: ${{ secrets.USERNAME }}
  55. password: ${{ secrets.PASSWORD }}
  56. port: 22
  57. source: webs/v/index.html
  58. target: ${{ secrets.WEB }}