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.

83 lines
2.3 KiB

Add logic to build stable and edge builds (#12052) This adds some logic to enable the snapcraft builds of the gitea snap to create both builds of the latest tip of master for edge channels, and stable releases. The logic simply looks for a new upstream release in github, and if that latest tagged release is not the same as the release in the candidate channel in the snap store, then it must be new, and so we checkout that tag and build that. If the current released tag is the same as what's in candidate, we build whatever is in git master. The process for using this is: Initially: When this lands, it will build the latest stable release of gitea and push to the edge channel in the snap store. Someone on the release team can go to https://snapcraft.io/gitea/releases and release that build to stable and candidate. Ongoing: The next build to be triggered will be a git master build, and can just sit in edge, nothing for the release team to do. On new release: The next build triggered will contain the stable release, and will be published to edge. Someone on the release team can login to the above URL and release that again to stable & candidate. Alternatively they can release to candidate, do some additional testing on that release before releasing to stable. Hope that all makes sense. Questions / comments welcome. I'm super keen to see stable releases of Gitea in the stable channel of the Snap Store. I'd like to promote it but I can't really until it's in stable. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
  1. name: gitea
  2. summary: Gitea - A painless self-hosted Git service
  3. description: |
  4. The goal of this project is to make the easiest, fastest, and most painless
  5. way of setting up a self-hosted Git service. With Go, this can be done with
  6. an independent binary distribution across ALL platforms that Go supports,
  7. including Linux, Mac OS X, Windows and ARM.
  8. icon: public/img/gitea-lg.png
  9. confinement: strict
  10. base: core18
  11. adopt-info: gitea
  12. architectures:
  13. - build-on: armhf
  14. - build-on: amd64
  15. - build-on: arm64
  16. environment:
  17. GITEA_CUSTOM: "$SNAP_COMMON"
  18. GITEA_WORK_DIR: "$SNAP_DATA"
  19. apps:
  20. gitea:
  21. command: gitea
  22. plugs: [network, network-bind]
  23. web:
  24. command: gitea web
  25. daemon: simple
  26. plugs: [network, network-bind]
  27. dump:
  28. command: gitea dump
  29. plugs: [home]
  30. version:
  31. command: gitea --version
  32. sqlite:
  33. command: usr/bin/sqlite3
  34. parts:
  35. gitea:
  36. plugin: make
  37. source: .
  38. stage-packages: [ git, sqlite3, openssh-client ]
  39. build-packages: [ git, libpam0g-dev, libsqlite3-dev]
  40. build-snaps: [ go, node/14/stable ]
  41. build-environment:
  42. - LDFLAGS: ""
  43. override-pull: |
  44. snapcraftctl pull
  45. last_committed_tag="$(git for-each-ref --sort=taggerdate --format '%(tag)' refs/tags | tail -n 1)"
  46. last_released_tag="$(snap info gitea | awk '$1 == "latest/candidate:" { print $2 }')"
  47. # If the latest tag from the upstream project has not been released to
  48. # stable, build that tag instead of master.
  49. if [ "${last_committed_tag}" != "${last_released_tag}" ]; then
  50. git fetch
  51. git checkout "${last_committed_tag}"
  52. fi
  53. version="$(git describe --always | sed -e 's/-/+git/;y/-/./')"
  54. [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
  55. snapcraftctl set-version "$version"
  56. snapcraftctl set-grade "$grade"
  57. override-build: |
  58. set -x
  59. TAGS="bindata sqlite sqlite_unlock_notify pam cert" make build
  60. install -D gitea "${SNAPCRAFT_PART_INSTALL}/gitea"
  61. cp -r options "${SNAPCRAFT_PART_INSTALL}/"
  62. prime:
  63. - -etc
  64. - -usr/lib/systemd
  65. - -usr/lib/gcc
  66. - -usr/lib/sasl2
  67. - -usr/lib/x86_64-linux-gnu/krb5
  68. - -usr/share/apport
  69. - -usr/share/bash-completion
  70. - -usr/share/git-core/contrib
  71. - -usr/share/man
  72. - -usr/share/upstart
  73. - -var