mirror of
https://gitea.com/gitea/tea.git
synced 2024-12-04 14:46:40 -05:00
f28ddccd90
Reviewed-on: https://gitea.com/gitea/tea/pulls/600 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: gitea-tea
|
|
base: core22
|
|
summary: Gitea CLI Tool
|
|
description: A command line tool to interact with Gitea servers
|
|
grade: stable
|
|
confinement: strict
|
|
|
|
architectures:
|
|
- build-on: amd64
|
|
- build-on: arm64
|
|
- build-on: armhf
|
|
|
|
adopt-info: tea
|
|
|
|
apps:
|
|
tea:
|
|
command: tea
|
|
plugs: [network, network-bind, removable-media]
|
|
|
|
parts:
|
|
tea:
|
|
plugin: make
|
|
source: https://gitea.com/gitea/tea.git
|
|
stage-packages: [ git, openssh-client ]
|
|
build-packages: [ git, build-essential]
|
|
build-snaps: [ go/1.21/stable ]
|
|
build-environment:
|
|
- LDFLAGS: ""
|
|
override-pull: |
|
|
craftctl default
|
|
|
|
git config --global --add safe.directory /root/parts/tea/src
|
|
last_committed_tag="$(git for-each-ref --sort=taggerdate --format '%(tag)' refs/tags | tail -n 1)"
|
|
last_released_tag="$(snap info gitea-tea | awk '$1 == "latest/candidate:" { print $2 }')"
|
|
# If the latest tag from the upstream project has not been released to
|
|
# stable, build that tag instead of main.
|
|
if [ "${last_committed_tag}" != "${last_released_tag}" ]; then
|
|
git fetch
|
|
git checkout "${last_committed_tag}"
|
|
fi
|
|
|
|
version="$(git describe --always | sed -e 's/-/+git/;y/-/./')"
|
|
[ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
|
|
craftctl set version="$version"
|
|
craftctl set grade="$grade"
|
|
|
|
override-build: |
|
|
set -x
|
|
go mod vendor
|
|
make build
|
|
install -D tea "${SNAPCRAFT_PART_INSTALL}/tea" |