@@ -1,32 +1,81 @@
11name: Release
22on:
3− # schedule:
4− # - cron: '0 0 * * *' # midnight UTC
5−
63 push:
74 tags:
8− - 'v[0-9]+.[0-9]+.[0-9]+'
9− ## - release
5+ - '[0-9]+.[0-9]+'
6+ - '[0-9]+.[0-9]+.[0-9]+'
107
118jobs:
9+ fetch-grammars:
10+ name: Fetch Grammars
11+ runs-on: ubuntu-latest
12+ steps:
13+ - name: Checkout sources
14+ uses: actions/checkout@v3
15+
16+ - name: Install stable toolchain
17+ uses: actions-rs/toolchain@v1
18+ with:
19+ profile: minimal
20+ toolchain: stable
21+ override: true
22+
23+ - name: Cache cargo registry
24+ uses: actions/cache@v3
25+ with:
26+ path: ~/.cargo/registry
27+ key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
28+ restore-keys: ${{ runner.os }}-v2-cargo-registry-
29+
30+ - name: Cache cargo index
31+ uses: actions/cache@v3
32+ with:
33+ path: ~/.cargo/git
34+ key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
35+ restore-keys: ${{ runner.os }}-v2-cargo-index-
36+
37+ - name: Cache cargo target dir
38+ uses: actions/cache@v3
39+ with:
40+ path: target
41+ key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
42+ restore-keys: ${{ runner.os }}-v2-cargo-build-target-
43+
44+ - name: Fetch tree-sitter grammars
45+ uses: actions-rs/cargo@v1
46+ env:
47+ HELIX_DISABLE_AUTO_GRAMMAR_BUILD: yes
48+ with:
49+ command: run
50+ args: -- --grammar fetch
51+
52+ - name: Bundle grammars
53+ run: tar cJf grammars.tar.xz -C runtime/grammars/sources .
54+
55+ - uses: actions/upload-artifact@v3
56+ with:
57+ name: grammars
58+ path: grammars.tar.xz
59+
1260 dist:
1361 name: Dist
62+ needs: [fetch-grammars]
1463 runs-on: ${{ matrix.os }}
1564 strategy:
1665 fail-fast: false # don't fail other jobs if one fails
1766 matrix:
18− build: [x86_64-linux, aarch64-linux, x86_64-macos, x86_64-windows] #, x86_64-win-gnu, win32-msvc
67+ build: [x86_64-linux, x86_64-macos, x86_64-windows] #, x86_64-win-gnu, win32-msvc
1968 include:
2069 - build: x86_64-linux
2170 os: ubuntu-20.04
2271 rust: stable
2372 target: x86_64-unknown-linux-gnu
2473 cross: false
25− - build: aarch64-linux
26− os: ubuntu-20.04
27− rust: stable
28− target: aarch64-unknown-linux-gnu
29− cross: true
74+ # - build: aarch64-linux
75+ # os: ubuntu-20.04
76+ # rust: stable
77+ # target: aarch64-unknown-linux-gnu
78+ # cross: true
3079 - build: x86_64-macos
3180 os: macos-latest
3281 rust: stable
@@ -54,6 +103,15 @@ jobs:
54103 - name: Checkout sources
55104 uses: actions/checkout@v3
56105
106+ - name: Download grammars
107+ uses: actions/download-artifact@v2
108+
109+ - name: Move grammars under runtime
110+ if: "!startsWith(matrix.os, 'windows')"
111+ run: |
112+ mkdir -p runtime/grammars/sources
113+ tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources
114+
57115 - name: Install ${{ matrix.rust }} toolchain
58116 uses: actions-rs/toolchain@v1
59117 with:
@@ -98,6 +156,7 @@ jobs:
98156 else
99157 cp "target/${{ matrix.target }}/release/hx" "dist/"
100158 fi
159+ rm -rf runtime/grammars/sources
101160 cp -r runtime dist
102161
103162 - uses: actions/upload-artifact@v3
@@ -118,7 +177,7 @@ jobs:
118177 - name: Calculate tag name
119178 run: |
120179 name=dev
121− if [[ $GITHUB_REF == refs/tags/v* ]]; then
180+ if [[ $GITHUB_REF == refs/tags/* ]]; then
122181 name=${GITHUB_REF:10}
123182 fi
124183 echo ::set-output name=val::$name
@@ -130,8 +189,13 @@ jobs:
130189 run: |
131190 set -ex
132191
133− rm -rf tmp
134− mkdir tmp
192+ source="$(pwd)"
193+ mkdir -p runtime/grammars/sources
194+ tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources
195+ rm -rf grammars
196+
197+ cd "$(mktemp -d)"
198+ mv $source/bins-* .
135199 mkdir dist
136200
137201 for dir in bins-* ; do
@@ -140,19 +204,22 @@ jobs:
140204 exe=".exe"
141205 fi
142206 pkgname=helix-$TAG-$platform
143− mkdir tmp/$pkgname
144− cp LICENSE README.md tmp/$pkgname
145− mv bins-$platform/runtime tmp/$pkgname/
146− mv bins-$platform/hx$exe tmp/$pkgname
147− chmod +x tmp/$pkgname/hx$exe
207+ mkdir $pkgname
208+ cp $source/LICENSE $source/README.md $pkgname
209+ mv bins-$platform/runtime $pkgname/
210+ mv bins-$platform/hx$exe $pkgname
211+ chmod +x $pkgname/hx$exe
148212
149213 if [ "$exe" = "" ]; then
150− tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
214+ tar cJf dist/$pkgname.tar.xz $pkgname
151215 else
152− (cd tmp && 7z a -r ../dist/$pkgname.zip $pkgname)
216+ 7z a -r dist/$pkgname.zip $pkgname
153217 fi
154218 done
155219
220+ tar cJf dist/helix-$TAG-source.tar.xz -C $source .
221+ mv dist $source/
222+
156223 - name: Upload binaries to release
157224 uses: svenstaro/upload-release-action@v2
158225 with: