build.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: build
  2. on:
  3. push:
  4. branches: [ master ]
  5. workflow_dispatch:
  6. workflow_call:
  7. concurrency:
  8. group: build-${{ github.ref }}
  9. cancel-in-progress: true
  10. # This job requires deploy keys to be added to target repositories (https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys)
  11. # Generate deploy keys locally:
  12. # $ ssh-keygen -t rsa -f awesome-selfhosted-deploy-key -C awesome-selfhosted-deploy-key
  13. # $ ssh-keygen -t rsa -f awesome-selfhosted-html-deploy-key -C awesome-selfhosted-html-deploy-key
  14. # Paste the contents of awesome-selfhosted-deploy-key.pub to https://github.com/awesome-selfhosted/awesome-selfhosted/settings/keys/new, name: awesome-selfhosted-deploy-key, allow write access
  15. # Paste the contents of awesome-selfhosted-html-deploy-key.pub to https://github.com/awesome-selfhosted/awesome-selfhosted-html/settings/keys/new, name: awesome-selfhosted-html-deploy-key, allow write access
  16. # Access https://github.com/awesome-selfhosted/awesome-selfhosted-data/settings/environments, create new environment with name: production
  17. # - deployment branches: selected branches
  18. # - add deployment branch rule: branch name pattern: master
  19. # - environment secrets: add secret with name: SSH_MARKDOWN_DEPLOY_KEY, and value: paste the contents of awesome-selfhosted-deploy-key
  20. # - environment secrets: add secret with name: SSH_HTML_DEPLOY_KEY, and value: paste the contents of awesome-selfhosted-html-deploy-key
  21. jobs:
  22. build-markdown:
  23. environment:
  24. name: production
  25. url: https://github.com/awesome-selfhosted/awesome-selfhosted
  26. runs-on: ubuntu-latest
  27. steps:
  28. - uses: actions/checkout@v4
  29. with:
  30. ref: ${{ github.ref }}
  31. - run: make install
  32. - run: make awesome_lint
  33. - run: make export_markdown
  34. - name: setup markdown repository SSH deploy key
  35. run: |
  36. mkdir -p ~/.ssh
  37. echo "${{ secrets.SSH_MARKDOWN_DEPLOY_KEY }}" > ~/.ssh/id_rsa
  38. chmod 0600 ~/.ssh/id_rsa
  39. - run: make push_markdown
  40. build-html:
  41. environment:
  42. name: production
  43. url: https://github.com/awesome-selfhosted/awesome-selfhosted-html
  44. runs-on: ubuntu-latest
  45. steps:
  46. - uses: actions/checkout@v4
  47. with:
  48. ref: ${{ github.ref }}
  49. - run: make install
  50. - run: make awesome_lint
  51. - run: make export_html
  52. - name: setup HTML repository SSH deploy key
  53. run: |
  54. mkdir -p ~/.ssh
  55. echo "${{ secrets.SSH_HTML_DEPLOY_KEY }}" > ~/.ssh/id_rsa
  56. chmod 0600 ~/.ssh/id_rsa
  57. - run: make push_html