-
Notifications
You must be signed in to change notification settings - Fork 8
171 lines (148 loc) · 5.83 KB
/
release.yml
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]+
env:
ZIG_VERSION: 0.13.0
GLIBC_VERSION: 2.17
BIN_DIR: ${{ github.workspace }}/bin
# Build with zig cc so we can target glibc 2.17, so we have broader compatibility
jobs:
linux:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- name: Install deps from apt
run: |
sudo apt-get update
sudo apt-get install -y fuse libfuse2 # For linuxdeploy.
sudo apt-get install -y build-essential curl gettext ninja-build unzip cmake
sudo apt-get install -y xz-utils # To extract zig
# Workaround for https://github.com/actions/checkout/issues/766.
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly'
uses: actions/checkout@v3
with:
repository: 'neovim/neovim'
ref: ${{ github.event.inputs.tag_name }}
fetch-depth: 0
- if: github.event_name == 'schedule' || github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
uses: actions/checkout@v3
with:
repository: 'neovim/neovim'
fetch-depth: 0
# zig cc with -02 implicitly adds -DNDEBUG so remove this from the generator flags
# Not needed for 0.10.1+ : https://github.com/neovim/neovim/pull/29599
- name: Patch Neovim
run: sed -i '/APPEND gen_cflags -O2/d' src/nvim/CMakeLists.txt || true
- name: Add "$BIN_DIR" to path
run: |
mkdir -p "$BIN_DIR"
echo "$BIN_DIR" >> $GITHUB_PATH
- name: Install Zig
run: |
curl -O https://ziglang.org/download/$ZIG_VERSION/zig-linux-$(arch)-$ZIG_VERSION.tar.xz
tar -xf zig-linux-$(arch)-$ZIG_VERSION.tar.xz
rm -rf zig-linux-$(arch)-$ZIG_VERSION.tar.xz
ln -s $(pwd)/zig-linux-$(arch)-$ZIG_VERSION/zig $BIN_DIR/zig
# Include -lunwind so luajit can be linked
# Include -g0 to strip debug info by default.
# Note: Cmake should override this for debug builds by appending -g
echo 'exec zig cc -target $(arch)-linux-gnu.${GLIBC_VERSION} -lunwind -g0 "$@"' > $BIN_DIR/zigcc
chmod +x $BIN_DIR/zigcc
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
run: |
echo 'CMAKE_BUILD_TYPE=Release' >> $GITHUB_ENV
echo 'APPIMAGE_TAG=latest' >> $GITHUB_ENV
- if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
run: |
echo 'CMAKE_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV
echo 'APPIMAGE_TAG=nightly' >> $GITHUB_ENV
- name: appimage
env:
CC: zigcc
run: ./scripts/genappimage.sh ${APPIMAGE_TAG}
- run: cpack --config build/CPackConfig.cmake
- uses: actions/upload-artifact@v3
with:
name: appimage
path: |
build/bin/nvim.appimage
build/bin/nvim.appimage.zsync
retention-days: 1
- uses: actions/upload-artifact@v3
with:
name: nvim-linux64
path: |
build/nvim-linux64.tar.gz
build/nvim-linux64.deb
retention-days: 1
- name: Export version
id: build
run: |
printf 'version<<END\n' >> $GITHUB_OUTPUT
./build/bin/nvim --version | head -n 3 >> $GITHUB_OUTPUT
printf 'END\n' >> $GITHUB_OUTPUT
publish:
needs: [linux]
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
# Must perform checkout first, since it deletes the target directory
# before running, and would therefore delete the downloaded artifacts
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gettext-base
- 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
- name: Publish release
env:
NVIM_VERSION: ${{ needs.linux.outputs.version }}
DEBUG: api
run: |
if [ "$TAG_NAME" == "nightly" ]; then
SUBJECT='Nvim development (prerelease) build'
PRERELEASE='--prerelease'
else
SUBJECT='Nvim release build'
PRERELEASE=
fi
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
if [ "$TAG_NAME" == "nightly" ]; then
git push origin :nightly || true
else
gh release delete stable --yes || true
git push origin :stable || true
gh release create stable \
--notes-file "$RUNNER_TEMP/notes.md" \
--title "$SUBJECT" \
--target $GITHUB_SHA \
nvim-linux64/* appimage/*
fi
gh release delete $TAG_NAME --yes || true
gh release create $TAG_NAME $PRERELEASE \
--notes-file "$RUNNER_TEMP/notes.md" \
--title "$SUBJECT" \
--target $GITHUB_SHA \
nvim-linux64/* appimage/*