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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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@v4
  20. with:
  21. go-version: "~1.21"
  22. check-latest: true
  23. - uses: actions/setup-node@v3
  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@v5
  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\///' -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: create github release
  59. run: |
  60. gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --draft --notes-from-tag dist/release/*
  61. env:
  62. GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
  63. docker-rootful:
  64. runs-on: ubuntu-latest
  65. steps:
  66. - uses: actions/checkout@v4
  67. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  68. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  69. - run: git fetch --unshallow --quiet --tags --force
  70. - uses: docker/setup-qemu-action@v2
  71. - uses: docker/setup-buildx-action@v2
  72. - uses: docker/metadata-action@v5
  73. id: meta
  74. with:
  75. images: gitea/gitea
  76. # this will generate tags in the following format:
  77. # latest
  78. # 1
  79. # 1.2
  80. # 1.2.3
  81. tags: |
  82. type=raw,value=latest
  83. type=semver,pattern={{major}}
  84. type=semver,pattern={{major}}.{{minor}}
  85. type=semver,pattern={{version}}
  86. - name: Login to Docker Hub
  87. uses: docker/login-action@v2
  88. with:
  89. username: ${{ secrets.DOCKERHUB_USERNAME }}
  90. password: ${{ secrets.DOCKERHUB_TOKEN }}
  91. - name: build rootful docker image
  92. uses: docker/build-push-action@v4
  93. with:
  94. context: .
  95. platforms: linux/amd64,linux/arm64
  96. push: true
  97. tags: ${{ steps.meta.outputs.tags }}
  98. labels: ${{ steps.meta.outputs.labels }}
  99. docker-rootless:
  100. runs-on: ubuntu-latest
  101. steps:
  102. - uses: actions/checkout@v4
  103. # fetch all commits instead of only the last as some branches are long lived and could have many between versions
  104. # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
  105. - run: git fetch --unshallow --quiet --tags --force
  106. - uses: docker/setup-qemu-action@v2
  107. - uses: docker/setup-buildx-action@v2
  108. - uses: docker/metadata-action@v5
  109. id: meta
  110. with:
  111. images: gitea/gitea
  112. # each tag below will have the suffix of -rootless
  113. flavor: |
  114. suffix=-rootless
  115. # this will generate tags in the following format (with -rootless suffix added):
  116. # latest
  117. # 1
  118. # 1.2
  119. # 1.2.3
  120. tags: |
  121. type=raw,value=latest
  122. type=semver,pattern={{major}}
  123. type=semver,pattern={{major}}.{{minor}}
  124. type=semver,pattern={{version}}
  125. - name: Login to Docker Hub
  126. uses: docker/login-action@v2
  127. with:
  128. username: ${{ secrets.DOCKERHUB_USERNAME }}
  129. password: ${{ secrets.DOCKERHUB_TOKEN }}
  130. - name: build rootless docker image
  131. uses: docker/build-push-action@v4
  132. with:
  133. context: .
  134. platforms: linux/amd64,linux/arm64
  135. push: true
  136. file: Dockerfile.rootless
  137. tags: ${{ steps.meta.outputs.tags }}
  138. labels: ${{ steps.meta.outputs.labels }}