build-stage.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # This is a basic workflow to help you get started with Actions
  2. name: Build-Stage
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. git-ref:
  7. description: "Release Git Ref (Which branch or tag to build?)"
  8. required: true
  9. default: "master"
  10. cloudflare-project-name:
  11. description: "Cloudflare pages project name"
  12. required: true
  13. default: "logseq-dev"
  14. release:
  15. types: [released]
  16. env:
  17. CLOJURE_VERSION: '1.11.1.1413'
  18. NODE_VERSION: '18'
  19. JAVA_VERSION: '17'
  20. jobs:
  21. build:
  22. runs-on: ubuntu-latest
  23. steps:
  24. - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
  25. with:
  26. ref: ${{ github.event.inputs.git-ref }}
  27. - name: Setup Java JDK
  28. uses: actions/setup-java@v3
  29. with:
  30. distribution: 'zulu'
  31. java-version: ${{ env.JAVA_VERSION }}
  32. - name: Install Node.js, NPM and Yarn
  33. uses: actions/setup-node@v3
  34. with:
  35. node-version: ${{ env.NODE_VERSION }}
  36. - name: Setup clojure
  37. uses: DeLaGuardo/[email protected]
  38. with:
  39. cli: ${{ env.CLOJURE_VERSION }}
  40. - name: Fetch yarn deps
  41. run: yarn cache clean && yarn install --frozen-lockfile
  42. - name: Set Build Environment Variables
  43. run: |
  44. echo "ENABLE_FILE_SYNC_PRODUCTION=false" >> $GITHUB_ENV
  45. - name: Build Released-Web
  46. run: |
  47. yarn gulp:build && clojure -M:cljs release app --config-merge '{:compiler-options {:source-map true :source-map-include-sources-content false :source-map-detail-level :symbols}}'
  48. rsync -avz --exclude node_modules --exclude android --exclude ios ./static/ ./public/static/
  49. ls -lR ./public
  50. - name: Publish to Cloudflare Pages
  51. uses: cloudflare/pages-action@1
  52. with:
  53. apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
  54. accountId: 2553ea8236c11ea0f88de28fce1cbfee
  55. projectName: ${{ github.event.inputs.cloudflare-project-name || 'logseq-dev' }}
  56. directory: 'public'
  57. gitHubToken: ${{ secrets.GITHUB_TOKEN }}
  58. branch: 'production'