aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 750fbb22b723161e8c66f331919c1b023dfd9656 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: release

on:
  push:
    tags:
    - "v*"
  pull_request:

jobs:
  release:
    runs-on: "ubuntu-latest"

    steps:
    - uses: actions/checkout@master

    - name: check repository state
      run: |
        tag="v3.12.2" # tag="${{ github.ref_name }}"
        version="${tag#v}"
        xyversion="${version%.*}"
        grep -q "LuaRocks version $version" "configure" || {
           echo
           echo "version in configure is incorrect. Please fix it."
           exit 1
        }
        grep -q "program_version = \"$version\"" src/luarocks/core/cfg.lua || {
           echo
           echo "program_version in src/luarocks/core/cfg.lua is incorrect. Please fix it."
           exit 1
        }
        grep -q "vars.VERSION = \"$xyversion\"" install.bat || {
           echo
           echo "vars.VERSION in install.bat is incorrect. Please fix it."
           exit 1
        }

    - name: make Unix tarball
      run: |
        tag="v3.12.2" # tag="${{ github.ref_name }}"
        version="${tag#v}"
        lrdir="luarocks-$version"
        out="unix_tarball/$lrdir"
        mkdir -p "$out"
        git ls-files | while read i
        do
           if [ -f "$i" ]
           then
              dir=`dirname $i`
              mkdir -p "$out/$dir"
              cp "$i" "$out/$dir"
           fi
        done
        cd "$out"
        rm -rf makedist install.bat win32 .github .gitignore
        cd ..
        tar czvpf ../"$lrdir.tar.gz" "$lrdir"

    - name: make Windows legacy zip
      run: |
        tag="v3.12.2" # tag="${{ github.ref_name }}"
        version="${tag#v}"
        lrdir="luarocks-$version-win32"
        out="windows_legacy/$lrdir"
        mkdir -p "$out"
        git ls-files | while read i
        do
           if [ -f "$i" ]
           then
              dir=`dirname $i`
              mkdir -p "$out/$dir"
              cp "$i" "$out/$dir"
           fi
        done
        cd "$out"
        rm -rf makedist Makefile GNUmakefile configure .github .gitignore test
        cd ..
        zip -r ../"$lrdir.zip" "$lrdir"

    - name: install Linux binary build deps
      run: |
        sudo apt install lua5.4 liblua5.4-dev libbz2-dev libssl-dev

#    - name: build Linux binary
#      run: |
#        tag="v3.12.2" # tag="${{ github.ref_name }}"
#        version="${tag#v}"
#        lrdir="luarocks-$version-linux-x86_64"
#        lua54dir="/usr"
#        ./configure --lua-version=5.4 --with-lua=$lua54dir
#        make binary
#        cd build-binary
#        mkdir "$lrdir"
#        cp luarocks.exe "$lrdir/luarocks"
#        cp luarocks-admin.exe "$lrdir/luarocks-admin"
#        zip "../$lrdir.zip" "$lrdir"/*

    - name: install Windows 32-bit binary bulid deps
      run: |
        sudo apt install gcc-mingw-w64-i686

    - name: build Windows 32-bit binary
      run: |
        tag="v3.12.2" # tag="${{ github.ref_name }}"
        version="${tag#v}"
        lrdir="luarocks-$version-windows-32"
        lua54dir="/usr"
        ./configure --lua-version=5.4 --with-lua=$lua54dir
        make windows-binary-32
        cd build-windows-binary-i686-w64-mingw32
        mkdir "$lrdir"
        cp luarocks.exe "$lrdir/luarocks.exe"
        cp luarocks-admin.exe "$lrdir/luarocks-admin.exe"
        zip "../$lrdir.zip" "$lrdir"/*

    - name: install Windows 64-bit binary bulid deps
      run: |
        sudo apt install gcc-mingw-w64-x86-64

    - name: build Windows 64-bit binary
      run: |
        tag="v3.12.2" # tag="${{ github.ref_name }}"
        version="${tag#v}"
        lrdir="luarocks-$version-windows-64"
        lua54dir="/usr"
        ./configure --lua-version=5.4 --with-lua=$lua54dir
        make windows-binary-64
        cd build-windows-binary-x86_64-w64-mingw32
        mkdir "$lrdir"
        cp luarocks.exe "$lrdir/luarocks.exe"
        cp luarocks-admin.exe "$lrdir/luarocks-admin.exe"
        zip "../$lrdir.zip" "$lrdir"/*

    - name: push to Releases
      env:
        GITHUB_USER: ${{ github.actor }}
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        tag="v3.12.2" # tag="${{ github.ref_name }}"
        version="${tag#v}"
        echo "LuaRocks $version" > release.txt
        echo hub release create -F release.txt \
          -a "luarocks-$version.tar.gz" \
          -a "luarocks-$version-linux-x86_64.zip" \
          -a "luarocks-$version-windows-32.zip" \
          -a "luarocks-$version-windows-64.zip" \
          "$tag"
        ls