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.3KB

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