You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

release-tag-version.yml 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. name: release-tag-version
  2. on:
  3. push:
  4. tags:
  5. - "v1.*"
  6. - "!v1*-rc*"
  7. - "!v1*-dev"
  8. concurrency:
  9. group: ${{ github.workflow }}-${{ github.ref }}
  10. cancel-in-progress: false
  11. jobs:
  12. binary:
  13. runs-on: nscloud
  14. steps:
  15. - uses: actions/checkout@v4
  16. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  17. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  18. - run: git fetch --unshallow --quiet --tags --force
  19. - uses: actions/setup-go@v5
  20. with:
  21. go-version-file: go.mod
  22. check-latest: true
  23. - uses: actions/setup-node@v4
  24. with:
  25. node-version: 20
  26. cache: npm
  27. cache-dependency-path: package-lock.json
  28. - run: make deps-frontend deps-backend
  29. # xgo build
  30. - run: make release
  31. env:
  32. TAGS: bindata sqlite sqlite_unlock_notify
  33. - name: import gpg key
  34. id: import_gpg
  35. uses: crazy-max/ghaction-import-gpg@v6
  36. with:
  37. gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
  38. passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
  39. - name: sign binaries
  40. run: |
  41. for f in dist/release/*; do
  42. 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"
  43. done
  44. # clean branch name to get the folder name in S3
  45. - name: Get cleaned branch name
  46. id: clean_name
  47. run: |
  48. REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//')
  49. echo "Cleaned name is ${REF_NAME}"
  50. echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
  51. - name: configure aws
  52. uses: aws-actions/configure-aws-credentials@v4
  53. with:
  54. aws-region: ${{ secrets.AWS_REGION }}
  55. aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  56. aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  57. - name: upload binaries to s3
  58. run: |
  59. aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
  60. - name: Install GH CLI
  61. uses: dev-hanz-ops/install-gh-cli-action@v0.1.0
  62. with:
  63. gh-cli-version: 2.39.1
  64. - name: create github release
  65. run: |
  66. gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-from-tag dist/release/*
  67. env:
  68. GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
  69. docker-rootful:
  70. runs-on: ubuntu-latest
  71. steps:
  72. - uses: actions/checkout@v4
  73. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  74. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  75. - run: git fetch --unshallow --quiet --tags --force
  76. - uses: docker/setup-qemu-action@v3
  77. - uses: docker/setup-buildx-action@v3
  78. - uses: docker/metadata-action@v5
  79. id: meta
  80. with:
  81. images: gitea/gitea
  82. # this will generate tags in the following format:
  83. # latest
  84. # 1
  85. # 1.2
  86. # 1.2.3
  87. tags: |
  88. type=semver,pattern={{major}}
  89. type=semver,pattern={{major}}.{{minor}}
  90. type=semver,pattern={{version}}
  91. - name: Login to Docker Hub
  92. uses: docker/login-action@v3
  93. with:
  94. username: ${{ secrets.DOCKERHUB_USERNAME }}
  95. password: ${{ secrets.DOCKERHUB_TOKEN }}
  96. - name: build rootful docker image
  97. uses: docker/build-push-action@v5
  98. with:
  99. context: .
  100. platforms: linux/amd64,linux/arm64
  101. push: true
  102. tags: ${{ steps.meta.outputs.tags }}
  103. labels: ${{ steps.meta.outputs.labels }}
  104. docker-rootless:
  105. runs-on: ubuntu-latest
  106. steps:
  107. - uses: actions/checkout@v4
  108. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  109. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  110. - run: git fetch --unshallow --quiet --tags --force
  111. - uses: docker/setup-qemu-action@v3
  112. - uses: docker/setup-buildx-action@v3
  113. - uses: docker/metadata-action@v5
  114. id: meta
  115. with:
  116. images: gitea/gitea
  117. # each tag below will have the suffix of -rootless
  118. flavor: |
  119. suffix=-rootless,onlatest=true
  120. # this will generate tags in the following format (with -rootless suffix added):
  121. # latest
  122. # 1
  123. # 1.2
  124. # 1.2.3
  125. tags: |
  126. type=semver,pattern={{major}}
  127. type=semver,pattern={{major}}.{{minor}}
  128. type=semver,pattern={{version}}
  129. - name: Login to Docker Hub
  130. uses: docker/login-action@v3
  131. with:
  132. username: ${{ secrets.DOCKERHUB_USERNAME }}
  133. password: ${{ secrets.DOCKERHUB_TOKEN }}
  134. - name: build rootless docker image
  135. uses: docker/build-push-action@v5
  136. with:
  137. context: .
  138. platforms: linux/amd64,linux/arm64
  139. push: true
  140. file: Dockerfile.rootless
  141. tags: ${{ steps.meta.outputs.tags }}
  142. labels: ${{ steps.meta.outputs.labels }}