gitea源码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. name: release-nightly
  2. on:
  3. push:
  4. branches: [main, release/v*]
  5. concurrency:
  6. group: ${{ github.workflow }}-${{ github.ref }}
  7. cancel-in-progress: true
  8. jobs:
  9. nightly-binary:
  10. runs-on: namespace-profile-gitea-release-binary
  11. steps:
  12. - uses: actions/checkout@v4
  13. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  14. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  15. - run: git fetch --unshallow --quiet --tags --force
  16. - uses: actions/setup-go@v5
  17. with:
  18. go-version-file: go.mod
  19. check-latest: true
  20. - uses: pnpm/action-setup@v4
  21. - uses: actions/setup-node@v5
  22. with:
  23. node-version: 24
  24. - run: make deps-frontend deps-backend
  25. # xgo build
  26. - run: make release
  27. env:
  28. TAGS: bindata sqlite sqlite_unlock_notify
  29. - name: import gpg key
  30. id: import_gpg
  31. uses: crazy-max/ghaction-import-gpg@v6
  32. with:
  33. gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
  34. passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
  35. - name: sign binaries
  36. run: |
  37. for f in dist/release/*; do
  38. echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f"
  39. done
  40. # clean branch name to get the folder name in S3
  41. - name: Get cleaned branch name
  42. id: clean_name
  43. run: |
  44. REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
  45. echo "Cleaned name is ${REF_NAME}"
  46. echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
  47. - name: configure aws
  48. uses: aws-actions/configure-aws-credentials@v4
  49. with:
  50. aws-region: ${{ secrets.AWS_REGION }}
  51. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  52. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  53. - name: upload binaries to s3
  54. run: |
  55. aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
  56. nightly-docker-rootful:
  57. runs-on: namespace-profile-gitea-release-docker
  58. permissions:
  59. packages: write # to publish to ghcr.io
  60. steps:
  61. - uses: actions/checkout@v4
  62. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  63. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  64. - run: git fetch --unshallow --quiet --tags --force
  65. - uses: actions/setup-go@v5
  66. with:
  67. go-version-file: go.mod
  68. check-latest: true
  69. - uses: docker/setup-qemu-action@v3
  70. - uses: docker/setup-buildx-action@v3
  71. - name: Get cleaned branch name
  72. id: clean_name
  73. run: |
  74. REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
  75. echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
  76. - name: Login to Docker Hub
  77. uses: docker/login-action@v3
  78. with:
  79. username: ${{ secrets.DOCKERHUB_USERNAME }}
  80. password: ${{ secrets.DOCKERHUB_TOKEN }}
  81. - name: Login to GHCR using PAT
  82. uses: docker/login-action@v3
  83. with:
  84. registry: ghcr.io
  85. username: ${{ github.repository_owner }}
  86. password: ${{ secrets.GITHUB_TOKEN }}
  87. - name: fetch go modules
  88. run: make vendor
  89. - name: build rootful docker image
  90. uses: docker/build-push-action@v5
  91. with:
  92. context: .
  93. platforms: linux/amd64,linux/arm64,linux/riscv64
  94. push: true
  95. tags: |-
  96. gitea/gitea:${{ steps.clean_name.outputs.branch }}
  97. ghcr.io/go-gitea/gitea:${{ steps.clean_name.outputs.branch }}
  98. nightly-docker-rootless:
  99. runs-on: namespace-profile-gitea-release-docker
  100. permissions:
  101. packages: write # to publish to ghcr.io
  102. steps:
  103. - uses: actions/checkout@v4
  104. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  105. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  106. - run: git fetch --unshallow --quiet --tags --force
  107. - uses: actions/setup-go@v5
  108. with:
  109. go-version-file: go.mod
  110. check-latest: true
  111. - uses: docker/setup-qemu-action@v3
  112. - uses: docker/setup-buildx-action@v3
  113. - name: Get cleaned branch name
  114. id: clean_name
  115. run: |
  116. REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
  117. echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
  118. - name: Login to Docker Hub
  119. uses: docker/login-action@v3
  120. with:
  121. username: ${{ secrets.DOCKERHUB_USERNAME }}
  122. password: ${{ secrets.DOCKERHUB_TOKEN }}
  123. - name: Login to GHCR using PAT
  124. uses: docker/login-action@v3
  125. with:
  126. registry: ghcr.io
  127. username: ${{ github.repository_owner }}
  128. password: ${{ secrets.GITHUB_TOKEN }}
  129. - name: fetch go modules
  130. run: make vendor
  131. - name: build rootless docker image
  132. uses: docker/build-push-action@v5
  133. with:
  134. context: .
  135. platforms: linux/amd64,linux/arm64
  136. push: true
  137. file: Dockerfile.rootless
  138. tags: |-
  139. gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless
  140. ghcr.io/go-gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless