aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yml
blob: 6d66ff0c181addb0cbef5171be4c51815cec57bd (plain) (blame)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Release
on:
  schedule:
    - cron: '5 5 * * *'
  workflow_dispatch:
    inputs:
      tag_name:
        description: 'Tag name for release'
        required: false
        default: nightly
  push:
    tags:
      - v[0-9]+.[0-9]+.[0-9]+

jobs:
  linux:
    runs-on: ubuntu-20.04
    outputs:
      version: ${{ steps.build.outputs.version }}
      release: ${{ steps.build.outputs.release }}
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y autoconf automake build-essential cmake gcc-multilib gettext gperf libtool-bin locales ninja-build pkg-config unzip
      - name: Build release
        id: build
        run: |
          make CMAKE_BUILD_TYPE=RelWithDebinfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH="
          printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')"
          printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)"
          make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install
          cd "$GITHUB_WORKSPACE/build/release"
          tar cfz nvim-linux64.tar.gz nvim-linux64
      - uses: actions/upload-artifact@v2
        with:
          name: nvim-linux64
          path: build/release/nvim-linux64.tar.gz
          retention-days: 1

  appimage:
    # Build on the oldest supported image, so we have broader compatibility
    runs-on: ubuntu-16.04
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y autoconf automake build-essential cmake gcc-multilib gettext gperf libtool-bin locales ninja-build pkg-config unzip
      - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
        run: make appimage-latest
      - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
        run: make appimage-nightly
      - uses: actions/upload-artifact@v2
        with:
          name: appimage
          path: build/bin/nvim.appimage
          retention-days: 1
      - uses: actions/upload-artifact@v2
        with:
          name: appimage
          path: build/bin/nvim.appimage.zsync
          retention-days: 1

  macOS:
    runs-on: macos-10.15
    steps:
      - uses: actions/checkout@v2
      - name: Install brew packages
        run: |
          brew update >/dev/null
          brew install automake ninja
      - name: Build release
        run: |
          make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11"
          make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-osx64" install
      - name: Create package
        run: |
          cd "$GITHUB_WORKSPACE/build/release"
          mkdir -p bundle/nvim/libs
          mkdir -p bundle/nvim/bin
          cp nvim-osx64/bin/nvim bundle/nvim/bin/
          libs=($(otool -L nvim-osx64/bin/nvim | sed 1d | sed -E -e 's|^[[:space:]]*||' -e 's| .*||'))
          echo "libs:"
          for lib in "${libs[@]}"; do
            if echo "$lib" | grep -q -E 'libSystem|CoreFoundation' 2>/dev/null; then
              echo "  [skipped] $lib"
            else
              echo "  $lib"
              relname="libs/${lib##*/}"
              cp -L "$lib" "bundle/nvim/$relname"
              install_name_tool -change "$lib" "@executable_path/../$relname" bundle/nvim/bin/nvim
            fi
          done
          tar cjSf nvim-macos.tar.bz2 -C bundle nvim
      - uses: actions/upload-artifact@v2
        with:
          name: nvim-macos
          path: build/release/nvim-macos.tar.bz2
          retention-days: 1

  publish:
    needs: [linux, appimage, macOS]
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/download-artifact@v2
      - if: github.event_name == 'workflow_dispatch'
        run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
      - if: github.event_name == 'schedule'
        run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
      - if: github.event_name == 'push'
        run: |
          TAG_NAME=${{ github.ref }}
          echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
      - if: env.TAG_NAME == 'nightly'
        run: echo 'SUBJECT=Nvim development (prerelease) build' >> $GITHUB_ENV
      - if: env.TAG_NAME != 'nightly'
        run: echo 'SUBJECT=Nvim release build' >> $GITHUB_ENV
      - if: env.TAG_NAME == 'nightly'
        uses: dev-drprasad/delete-tag-and-release@v0.1.2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          delete_release: false
          tag_name: nightly
      - uses: meeDamian/github-release@2.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          tag: ${{ env.TAG_NAME }}
          name: ${{ needs.linux.outputs.release }}
          prerelease: ${{ env.TAG_NAME == 'nightly' }}
          commitish: ${{ github.sha }}
          gzip: false
          allow_override: ${{ env.TAG_NAME == 'nightly' }}
          files: |
            nvim-macos.tar.bz2:./nvim-macos/nvim-macos.tar.bz2
            nvim-linux64.tar.gz:./nvim-linux64/nvim-linux64.tar.gz
            nvim.appimage:./appimage/nvim.appimage
            nvim.appimage.zsync:./appimage/nvim.appimage.zsync
          body: |
            ${{ env.SUBJECT }}
            ```
            ${{ needs.linux.outputs.version }}```

            ## Install

            ### Windows

            1. Extract **nvim-win64.zip** (or **nvim-win32.zip**)
            2. Run `nvim-qt.exe`

            ### macOS

            1. Download **nvim-macos.tar.gz**
            2. Extract: `tar xzvf nvim-macos.tar.gz`
            3. Run `./nvim-osx64/bin/nvim`

            ### Linux (x64)

            1. Download **nvim.appimage**
            2. Run `chmod u+x nvim.appimage && ./nvim.appimage`
               - If your system does not have FUSE you can [extract the appimage](https://github.com/AppImage/AppImageKit/wiki/FUSE#type-2-appimage):
                 ```
                 ./nvim.appimage --appimage-extract
                 ./squashfs-root/usr/bin/nvim
                 ```

            ### Other

            - Install by [package manager](https://github.com/neovim/neovim/wiki/Installing-Neovim)