aboutsummaryrefslogtreecommitdiffstats
path: root/snap/snapcraft.yaml
blob: cd989dfbbf0a2e3a019cc127cdcf09fb1e0296f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: gitea
summary:  Gitea - A painless self-hosted Git service
description: |
  The goal of this project is to make the easiest, fastest, and most painless
  way of setting up a self-hosted Git service. With Go, this can be done with
  an independent binary distribution across ALL platforms that Go supports,
  including Linux, Mac OS X, Windows and ARM.

icon: public/img/logo.png
confinement: strict
base: core18
adopt-info: gitea

architectures:
  - build-on: armhf
  - build-on: amd64
  - build-on: arm64

environment:
  GITEA_CUSTOM: "$SNAP_COMMON"
  GITEA_WORK_DIR: "$SNAP_COMMON"
  GIT_TEMPLATE_DIR: "$SNAP/usr/share/git-core/templates"
  GIT_EXEC_PATH: "$SNAP/usr/lib/git-core"

apps:
  gitea:
    command: gitea
    plugs: [network, network-bind, removable-media]
  web:
    command: gitea web
    daemon: simple
    plugs: [network, network-bind, removable-media]
  dump:
    command: gitea dump
    plugs: [home, removable-media]
  version:
    command: gitea --version
  sqlite:
    command: usr/bin/sqlite3

parts:

  gitea:
    plugin: make
    source: .
    stage-packages: [ git, sqlite3, openssh-client ]
    build-packages: [ git, libpam0g-dev, libsqlite3-dev]
    build-snaps: [ go, node/14/stable ]
    build-environment:
      - LDFLAGS: ""
    override-pull: |
      snapcraftctl pull
      
      last_committed_tag="$(git for-each-ref --sort=taggerdate --format '%(tag)' refs/tags | tail -n 1)"
      last_released_tag="$(snap info gitea | 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 master.
      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
      snapcraftctl set-version "$version"
      snapcraftctl set-grade "$grade"

    override-build: |
      set -x
      TAGS="bindata sqlite sqlite_unlock_notify pam cert" make build
      install -D gitea "${SNAPCRAFT_PART_INSTALL}/gitea"
      cp -r options "${SNAPCRAFT_PART_INSTALL}/"

    prime:
      - -etc
      - -usr/lib/systemd
      - -usr/lib/gcc
      - -usr/lib/sasl2
      - -usr/lib/x86_64-linux-gnu/krb5
      - -usr/share/apport
      - -usr/share/bash-completion
      - -usr/share/git-core/contrib
      - -usr/share/man
      - -usr/share/upstart
      - -var