main.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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: Set up Python 3.10
  20. uses: actions/setup-python@v4
  21. with:
  22. python-version: '3.10'
  23. - name: Checkout 2d-components repo
  24. uses: actions/checkout@v3
  25. with:
  26. repository: le5le-com/2d-components
  27. token: ${{ secrets.PAT }}
  28. path: 2d-components
  29. - name: Install core
  30. run: |
  31. cd meta2d.js
  32. yarn
  33. - uses: pnpm/action-setup@v2
  34. with:
  35. version: latest
  36. - name: Build
  37. run: |
  38. cd webs
  39. pnpm i && pnpm run prod
  40. - name: 安装pipx
  41. run: |
  42. sudo apt install pipx
  43. - name: 配置pipx环境变量
  44. run: pipx ensurepath
  45. - name: pipx completions
  46. run: pipx completions
  47. - name: 添加pipxPATH
  48. run: |
  49. eval "$(register-python-argcomplete pipx)"
  50. - name: 安装COS
  51. run: |
  52. sudo pipx install coscmd --python /opt/hostedtoolcache/Python/3.10.15/x64/bin/python3.10
  53. - name: 配置COS
  54. env:
  55. SECRET_ID: ${{ secrets.SECRET_ID }}
  56. SECRET_KEY: ${{ secrets.SECRET_KEY }}
  57. BUCKET: ${{ secrets.BUCKET }}
  58. REGION: ${{ secrets.COS_REGION }}
  59. run: |
  60. coscmd config -a $SECRET_ID -s $SECRET_KEY -b $BUCKET -r $REGION
  61. - name: Upload COS
  62. run: |
  63. coscmd upload -rs ./webs/v/ /v/
  64. - name: Upload index.html
  65. uses: appleboy/scp-action@v0.1.7
  66. with:
  67. host: ${{ secrets.HOST }}
  68. username: ${{ secrets.USERNAME }}
  69. password: ${{ secrets.PASSWORD }}
  70. port: 22
  71. source: webs/v/index.html
  72. target: ${{ secrets.WEB }}