1
0

update.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Update JS Bundle
  2. # Controls when the action will run.
  3. on:
  4. repository_dispatch:
  5. types: [update]
  6. workflow_dispatch:
  7. # A workflow run is made up of one or more jobs that can run sequentially or in parallel
  8. jobs:
  9. update:
  10. runs-on: ubuntu-latest
  11. # Steps represent a sequence of tasks that will be executed as part of the job
  12. steps:
  13. # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  14. - name: Checkout repo
  15. uses: actions/checkout@v2
  16. with:
  17. repository: Fuukei/Sakurairo_Scripts
  18. path: ./script
  19. - name: Setup Node.js environment
  20. uses: actions/setup-node@v2.1.5
  21. - name: Cache node modules
  22. uses: actions/cache@v2
  23. env:
  24. cache-name: cache-node-modules
  25. with:
  26. # npm cache files are stored in `~/.npm` on Linux/macOS
  27. path: ~/.npm
  28. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  29. restore-keys: |
  30. ${{ runner.os }}-build-${{ env.cache-name }}-
  31. ${{ runner.os }}-build-
  32. ${{ runner.os }}-
  33. - name: Install dependencies
  34. run: |
  35. cd $GITHUB_WORKSPACE/script
  36. npm i
  37. - name: Build bundle
  38. run: |
  39. cd $GITHUB_WORKSPACE/script
  40. npm run build
  41. - name: Checkout self
  42. uses: actions/checkout@v2
  43. with:
  44. path: ./theme
  45. - name: Copy files
  46. run: cp -r $GITHUB_WORKSPACE/script/dist/* $GITHUB_WORKSPACE/theme/js/
  47. - name: Make Commit Message (Last Commit)
  48. run: |
  49. cd $GITHUB_WORKSPACE/script
  50. echo $(git show -s --format=format:"last commit: %h by %aN,%n%B | %ci") > _commits
  51. - name: Export to env
  52. uses: pCYSl5EDgo/cat@master
  53. id: commits
  54. with:
  55. path: ./script/_commits
  56. - name: Commit
  57. uses: zwaldowski/git-commit-action@v1
  58. with:
  59. commit_message: ${{ steps.commits.outputs.text }}
  60. working_directory: ./theme
  61. - run: |
  62. cd $GITHUB_WORKSPACE/theme
  63. git push origin