robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 1dc9728daa1d8a2702

master
9.7 KiB292 linesraw
1name: release
2on:
3  schedule:
4    - cron: '5 5 * * *'
5  workflow_dispatch:
6    inputs:
7      tag_name:
8        description: 'Tag name for release'
9        required: false
10        default: nightly
11  push:
12    tags:
13      - v[0-9]+.[0-9]+.[0-9]+
14
15permissions:
16  contents: read
17
18# Build on the oldest supported images, so we have broader compatibility
19jobs:
20  setup:
21    runs-on: ubuntu-latest
22    outputs:
23      build_type: ${{ steps.build.outputs.build_type }}
24      appimage_tag: ${{ steps.build.outputs.appimage_tag }}
25    steps:
26      # Nightly uses RelWithDebInfo while stable uses Release (which disables
27      # asserts). This helps get better debug info from people brave enough to
28      # use the nightly builds.
29      - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
30        run: |
31          echo 'CMAKE_BUILD_TYPE=Release' >> $GITHUB_ENV
32          echo 'APPIMAGE_TAG=latest' >> $GITHUB_ENV
33      - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
34        run: |
35          echo 'CMAKE_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV
36          echo 'APPIMAGE_TAG=nightly' >> $GITHUB_ENV
37      - name: Export build information
38        id: build
39        run: |
40          printf "build_type=${CMAKE_BUILD_TYPE}\n" >> $GITHUB_OUTPUT
41          printf "appimage_tag=${APPIMAGE_TAG}\n" >> $GITHUB_OUTPUT
42
43  linux:
44    needs: setup
45    strategy:
46      fail-fast: false
47      matrix:
48        runner: [ ubuntu-22.04, ubuntu-22.04-arm ]
49        include:
50          - runner: ubuntu-22.04
51            arch: x86_64
52          - runner: ubuntu-22.04-arm
53            arch: arm64
54    runs-on: ${{ matrix.runner }}
55    env:
56      CC: ${{ matrix.cc }}
57      LDAI_NO_APPSTREAM: 1 # skip checking (broken) AppStream metadata for issues
58    outputs:
59      version: ${{ steps.build.outputs.version }}
60    steps:
61      - uses: actions/checkout@v7.0.1
62        with:
63          # Perform a full checkout #13471
64          fetch-depth: 0
65          persist-credentials: false
66      - run: ./.github/scripts/install_deps.sh
67      - run: sudo apt-get install -y libfuse2
68
69      - run: echo "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" >> $GITHUB_ENV
70        env:
71          CMAKE_BUILD_TYPE: ${{ needs.setup.outputs.build_type }}
72
73      - name: appimage
74        env:
75          APPIMAGE_TAG: ${{ needs.setup.outputs.appimage_tag }}
76        run:  |
77          ./scripts/genappimage.sh "${APPIMAGE_TAG}"
78
79      - name: tar.gz
80        run: cpack --config build/CPackConfig.cmake -G TGZ
81      - uses: actions/upload-artifact@v7
82        with:
83          name: nvim-appimage-${{ matrix.arch }}
84          path: |
85            build/bin/nvim-linux-${{ matrix.arch }}.appimage
86            build/bin/nvim-linux-${{ matrix.arch }}.appimage.zsync
87          retention-days: 1
88      - uses: actions/upload-artifact@v7
89        with:
90          name: nvim-linux-${{ matrix.arch }}
91          path: |
92            build/nvim-linux-${{ matrix.arch }}.tar.gz
93          retention-days: 1
94      - name: Export version
95        id: build
96        run: |
97          printf 'version<<END\n' >> $GITHUB_OUTPUT
98          ./build/bin/nvim --version | head -n 3 >> $GITHUB_OUTPUT
99          printf 'END\n' >> $GITHUB_OUTPUT
100  macos:
101    needs: setup
102    strategy:
103      fail-fast: false
104      matrix:
105        runner: [ macos-15-intel, macos-15 ]
106        include:
107          - runner: macos-15-intel
108            arch: x86_64
109          - runner: macos-15
110            arch: arm64
111    runs-on: ${{ matrix.runner }}
112    env:
113      CMAKE_BUILD_TYPE: ${{ needs.setup.outputs.build_type }}
114      MACOSX_DEPLOYMENT_TARGET: 11.0
115    steps:
116      - uses: actions/checkout@v7.0.1
117        with:
118          # Perform a full checkout #13471
119          fetch-depth: 0
120          persist-credentials: false
121      - name: Install dependencies
122        run: ./.github/scripts/install_deps.sh
123
124      - name: Build deps
125        run: |
126          cmake -S cmake.deps -B .deps -G Ninja \
127            -D CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
128            -D CMAKE_FIND_FRAMEWORK=NEVER
129          cmake --build .deps
130      - name: Build neovim
131        run: |
132          cmake -B build -G Ninja \
133            -D CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
134            -D ENABLE_LIBINTL=OFF \
135            -D CMAKE_FIND_FRAMEWORK=NEVER
136          cmake --build build
137      - name: Package
138        run: cpack --config build/CPackConfig.cmake
139
140      - uses: actions/upload-artifact@v7
141        with:
142          name: nvim-macos-${{ matrix.arch }}
143          path: build/nvim-macos-${{ matrix.arch }}.tar.gz
144          retention-days: 1
145
146  windows:
147    needs: setup
148    strategy:
149      matrix:
150        include:
151          - runner: windows-2022
152            arch: x86_64
153            archive_name: nvim-win64
154          - runner: windows-11-arm
155            arch: arm64
156            archive_name: nvim-win-arm64
157    runs-on: ${{ matrix.runner }}
158    env:
159      CMAKE_BUILD_TYPE: ${{ needs.setup.outputs.build_type }}
160    steps:
161      - uses: actions/checkout@v7.0.1
162        with:
163          # Perform a full checkout #13471
164          fetch-depth: 0
165          persist-credentials: false
166      - run: .github/scripts/env.ps1
167        env:
168          BUILD_ARCH: ${{ matrix.arch }}
169      - name: Install Wix
170        run: |
171          Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip" -OutFile "wix314-binaries.zip"
172          Expand-Archive -Path "wix314-binaries.zip" -DestinationPath "C:/wix"
173          echo "C:\wix" >> $env:GITHUB_PATH
174      - name: Build deps
175        shell: pwsh
176        run: |
177          cmake -S cmake.deps -B .deps -G Ninja -DCMAKE_BUILD_TYPE="${env:CMAKE_BUILD_TYPE}"
178          cmake --build .deps
179      - name: Build package
180        shell: pwsh
181        run: |
182          cmake -B build -G Ninja -DCMAKE_BUILD_TYPE="${env:CMAKE_BUILD_TYPE}"
183          cmake --build build --target package
184      - name: Upload artifact
185        uses: actions/upload-artifact@v7
186        with:
187          name: nvim-win-${{ matrix.arch }}
188          path: |
189            build/${{ matrix.archive_name }}.zip
190            build/${{ matrix.archive_name }}.msi
191          retention-days: 1
192
193  wasm:
194    needs: setup
195    runs-on: ubuntu-24.04
196
197    steps:
198      - name: Checkout
199        uses: actions/checkout@v7
200        with:
201          persist-credentials: false
202
203      - name: Set up Zig
204        uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
205        with:
206          version: 0.16.0
207          use-cache: false
208
209      - name: Install system deps
210        run: |
211          sudo apt-get update
212          sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
213            python3 python3-pip curl unzip zip
214
215      - name: Install Emscripten SDK
216        run: |
217          set -euo pipefail
218          git clone https://github.com/emscripten-core/emsdk.git ./.emsdk
219          cd ./.emsdk
220          ./emsdk install 6.0.2
221          ./emsdk activate 6.0.2
222          cd -
223
224      - name: Build nvim.wasm
225        run: .github/scripts/build_wasm.sh
226        env:
227          BUNDLE_WASM: "1"
228
229      - name: Upload wasm artifact
230        uses: actions/upload-artifact@v7
231        with:
232          name: nvim-wasm-emscripten
233          path: nvim-wasm-emscripten.zip
234          retention-days: 1
235
236  publish:
237    needs: [linux, macos, windows, wasm]
238    runs-on: ubuntu-latest
239    env:
240      GH_REPO: ${{ github.repository }}
241      GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
242    permissions:
243      contents: write
244    steps:
245      # Must perform checkout first, since it deletes the target directory
246      # before running, and would therefore delete the downloaded artifacts
247      - uses: actions/checkout@v7.0.1
248        with:
249          persist-credentials: false
250
251      - uses: actions/download-artifact@v8
252
253      - name: Install dependencies
254        run: sudo apt-get update && sudo apt-get install -y gettext-base
255
256      - if: github.event_name == 'workflow_dispatch'
257        env:
258          TAG_NAME: ${{ github.event.inputs.tag_name }}
259        run: echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
260
261      - if: github.event_name == 'schedule'
262        run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
263
264      - if: github.event_name == 'push'
265        run: |
266          echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
267
268      - if: env.TAG_NAME == 'nightly'
269        run: |
270          (echo 'SUBJECT=Nvim development (prerelease) build';
271           echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
272          gh release delete nightly --yes || true
273          git push https://${GITHUB_ACTOR}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} :nightly || true
274
275      - if: env.TAG_NAME != 'nightly'
276        run: |
277          (echo 'SUBJECT=Nvim release build';
278           echo 'PRERELEASE=') >> $GITHUB_ENV
279          gh release delete stable --yes || true
280          git push https://${GITHUB_ACTOR}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY} :stable || true
281
282      - name: Publish release
283        env:
284          NVIM_VERSION: ${{ needs.linux.outputs.version }}
285          NVIM_COMMIT: ${{ github.sha }}
286          DEBUG: api
287        run: |
288          envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
289          if [ "$TAG_NAME" != "nightly" ]; then
290            gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win-x86_64/* nvim-win-arm64/* nvim-wasm-emscripten/*
291          fi
292          gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win-x86_64/* nvim-win-arm64/* nvim-wasm-emscripten/*