deploy.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. name: Deploy preview
  2. on:
  3. push:
  4. branches:
  5. - master
  6. jobs:
  7. cdn:
  8. name: CDN
  9. if: "! contains(github.event.head_commit.message, '[skip ci]')"
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v1
  13. - uses: bahmutov/npm-install@v1
  14. - name: Set vue cli env
  15. shell: bash
  16. run: |
  17. echo -e "\
  18. VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/preview/\
  19. " > .env.preview.local
  20. cat .env.preview.local | while read line
  21. do
  22. echo $line
  23. done
  24. - name: Build
  25. run: yarn build:preview --report
  26. - name: Setup qshell
  27. uses: foxundermoon/setup-qshell@v1
  28. env:
  29. ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
  30. with:
  31. qshell-version: '2.4.0'
  32. - name: Test qshell
  33. run: qshell version
  34. - name: Login
  35. run: qshell account ${{ secrets.AK }} ${{ secrets.SK }} GITHUB_ACTION
  36. - name: CDN upload
  37. run: |
  38. qshell qupload2 \
  39. --src-dir=$GITHUB_WORKSPACE/dist \
  40. --bucket=d2-cdn \
  41. --key-prefix=${GITHUB_REPOSITORY//*\//}/preview/ \
  42. --overwrite=true \
  43. --check-exists=true \
  44. --check-hash=true \
  45. --check-size=true \
  46. --rescan-local=true \
  47. --thread-count=32
  48. - name: CDN refresh
  49. run: |
  50. echo "https://cdn.d2.pub/${GITHUB_REPOSITORY//*\//}/preview/" > cdnrefresh.txt
  51. qshell cdnrefresh --dirs -i ./cdnrefresh.txt
  52. ftp:
  53. name: FTP
  54. if: "! contains(github.event.head_commit.message, '[skip ci]')"
  55. runs-on: ubuntu-latest
  56. steps:
  57. - uses: actions/checkout@v1
  58. - uses: bahmutov/npm-install@v1
  59. - name: Set vue cli env
  60. shell: bash
  61. run: |
  62. echo -e "\
  63. VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/preview/\
  64. " > .env.preview.local
  65. cat .env.preview.local | while read line
  66. do
  67. echo $line
  68. done
  69. - name: Build
  70. run: yarn build:preview --report
  71. - name: Deploy
  72. uses: SamKirkland/FTP-Deploy-Action@2.0.0
  73. env:
  74. FTP_SERVER: ${{ secrets.FTP_SERVER }}
  75. FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
  76. FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
  77. METHOD: sftp
  78. PORT: ${{ secrets.FTP_PORT }}
  79. LOCAL_DIR: dist
  80. REMOTE_DIR: /www/d2-admin-start-kit/preview
  81. ARGS: --delete --verbose --parallel=100
  82. gh-pages:
  83. name: Github Pages
  84. if: "! contains(github.event.head_commit.message, '[skip ci]')"
  85. runs-on: ubuntu-latest
  86. steps:
  87. - uses: actions/checkout@v1
  88. - uses: bahmutov/npm-install@v1
  89. - name: Set vue cli env
  90. shell: bash
  91. run: |
  92. echo -e "\
  93. VUE_APP_PUBLIC_PATH=/d2-admin-start-kit/\
  94. " > .env.preview.local
  95. cat .env.preview.local | while read line
  96. do
  97. echo $line
  98. done
  99. - name: Build
  100. run: yarn build:preview --report
  101. - name: Deploy
  102. uses: peaceiris/actions-gh-pages@v2
  103. env:
  104. PERSONAL_TOKEN: ${{ secrets.ACCESS_TOKEN }}
  105. PUBLISH_BRANCH: gh-pages
  106. PUBLISH_DIR: ./dist
  107. with:
  108. forceOrphan: true