aboutsummaryrefslogtreecommitdiffstats
path: root/dist/release.sh
blob: d6522a871ad7cc58296bd7e6751f7f586bf443ca (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
set -e

TAG="${1:-scm}"
REVISION="${2:-1}"

if [ "$TAG" = scm ]; then
  WHERE=""
  TAG=""
  VERSION="scm"
else
  VERSION="${TAG#v}"
  VERSION=$(echo "$VERSION" | tr -d -)

  if [ ! -z "$(git status --porcelain -uno)" ]; then
    echo "working directory not clean!"
    exit 2
  fi

  cat <<EOF >"alv/version.moon"
----
-- \`alive\` source code version information.
--
-- @module version

--- exports
-- @table exports
-- @tfield string tag the last versions git tag
-- @tfield string web the repo web URL
-- @tfield string repo the git repo URL
-- @tfield string release the web URL of this release
{
  tag: "${TAG}"
  web: "https://github.com/s-ol/alive"
  repo: "https://github.com/s-ol/alive.git"
  release: "https://github.com/s-ol/alive/releases/tag/${TAG}"
}
EOF

  WHERE="
  tag = \"$TAG\","
fi

list_modules() {
  for FILE in $(git ls-files "$1" | grep '\.moon$'); do
    MODULE=$(echo "$FILE" | sed -e "s/\.moon$//" -e "s/\//./g")
    echo "      [\"$MODULE\"] = \"$FILE\","
  done
}

cat <<STOP >"dist/rocks/alive-$VERSION-$REVISION.rockspec"
package = "alive"
version = "$VERSION-$REVISION"

source = {
  url = "git://github.com/s-ol/alive.git",$WHERE
}

description = {
  summary = "Experimental livecoding environment with persistent expressions",
  detailed = [[
This is an experimental livecoding language and environment, in which
expressions persist and update until they are removed from the source code, and
the interpreter keeps no state that you cannot manipulate directly in the
source. This yields a direct-manipulation like experience with a purely
text-based language and works without special editor support.]],
  homepage = "https://alive.s-ol.nu",
  license = "GPL-3",
}

dependencies = {
  "lua",
  "moonscript >= 0.5.0",
  "lpeg ~> 0.10",
  "luafilesystem",
  "luasystem",
  "luasocket",
  "osc",
}

build = {
  type = "builtin",
  modules = {},
  copy_directories = { "docs" },
  install = {
    lua = {
$(list_modules alv)

$(list_modules alv-lib)
    },
    bin = {
      "bin/alv",
      "bin/alv-wx"
    },
  },
}
STOP

if [ -n "$TAG" ]; then
  git add "alv/version.moon" "dist/rocks/alive-$VERSION-$REVISION.rockspec"
  git commit -m "release $TAG"
  git tag -am "version $TAG" "$TAG"
  git push github "$TAG"

  luarocks pack "dist/rocks/alive-$VERSION-$REVISION.rockspec" \
    --sign
  mv "alive-$VERSION-$REVISION.src.rock" "alive-$VERSION-$REVISION.src.rock.asc" dist/rocks
  luarocks make "dist/rocks/alive-$VERSION-$REVISION.rockspec" \
    --pack-binary-rock \
    --sign
  mv "alive-$VERSION-$REVISION.all.rock" "alive-$VERSION-$REVISION.all.rock.asc" dist/rocks
  dist/pack-win.sh "$TAG" "$VERSION-$REVISION"
fi