@@ -1,32 +1,81 @@
1name: Release
1name: Release
4− # - cron: '0 0 * * *' # midnight UTC
8− - 'v[0-9]+.[0-9]+.[0-9]+'
5+ - '[0-9]+.[0-9]+'
9− ## - release
6+ - '[0-9]+.[0-9]+.[0-9]+'
11+ runs-on: ubuntu-latest
13+ - name: Checkout sources
14+ uses: actions/checkout@v3
16+ - name: Install stable toolchain
17+ uses: actions-rs/toolchain@v1
23+ - name: Cache cargo registry
24+ uses: actions/cache@v3
26+ path: ~/.cargo/registry
27+ key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
28+ restore-keys: ${{ runner.os }}-v2-cargo-registry-
30+ - name: Cache cargo index
31+ uses: actions/cache@v3
34+ key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
35+ restore-keys: ${{ runner.os }}-v2-cargo-index-
37+ - name: Cache cargo target dir
38+ uses: actions/cache@v3
41+ key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
42+ restore-keys: ${{ runner.os }}-v2-cargo-build-target-
44+ - name: Fetch tree-sitter grammars
45+ uses: actions-rs/cargo@v1
47+ HELIX_DISABLE_AUTO_GRAMMAR_BUILD: yes
50+ args: -- --grammar fetch
52+ - name: Bundle grammars
53+ run: tar cJf grammars.tar.xz -C runtime/grammars/sources .
55+ - uses: actions/upload-artifact@v3
58+ path: grammars.tar.xz
13 name: Dist
61 name: Dist
62+ needs: [fetch-grammars]
14 runs-on: ${{ matrix.os }}
63 runs-on: ${{ matrix.os }}
16 fail-fast: false # don't fail other jobs if one fails
65 fail-fast: false # don't fail other jobs if one fails
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
20 - build: x86_64-linux
69 - build: x86_64-linux
21 os: ubuntu-20.04
70 os: ubuntu-20.04
22 rust: stable
71 rust: stable
23 target: x86_64-unknown-linux-gnu
72 target: x86_64-unknown-linux-gnu
24 cross: false
73 cross: false
25− - build: aarch64-linux
74+ # - build: aarch64-linux
26− os: ubuntu-20.04
75+ # os: ubuntu-20.04
27− rust: stable
76+ # rust: stable
28− target: aarch64-unknown-linux-gnu
77+ # target: aarch64-unknown-linux-gnu
29− cross: true
78+ # cross: true
30 - build: x86_64-macos
79 - build: x86_64-macos
31 os: macos-latest
80 os: macos-latest
32 rust: stable
81 rust: stable
@@ -54,6 +103,15 @@ jobs:
54 - name: Checkout sources
103 - name: Checkout sources
55 uses: actions/checkout@v3
104 uses: actions/checkout@v3
106+ - name: Download grammars
107+ uses: actions/download-artifact@v2
109+ - name: Move grammars under runtime
110+ if: "!startsWith(matrix.os, 'windows')"
112+ mkdir -p runtime/grammars/sources
113+ tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources
57 - name: Install ${{ matrix.rust }} toolchain
115 - name: Install ${{ matrix.rust }} toolchain
58 uses: actions-rs/toolchain@v1
116 uses: actions-rs/toolchain@v1
@@ -98,6 +156,7 @@ jobs:
99 cp "target/${{ matrix.target }}/release/hx" "dist/"
157 cp "target/${{ matrix.target }}/release/hx" "dist/"
159+ rm -rf runtime/grammars/sources
101 cp -r runtime dist
160 cp -r runtime dist
103 - uses: actions/upload-artifact@v3
162 - uses: actions/upload-artifact@v3
@@ -118,7 +177,7 @@ jobs:
118 - name: Calculate tag name
177 - name: Calculate tag name
121− if [[ $GITHUB_REF == refs/tags/v* ]]; then
180+ if [[ $GITHUB_REF == refs/tags/* ]]; then
122 name=${GITHUB_REF:10}
181 name=${GITHUB_REF:10}
124 echo ::set-output name=val::$name
183 echo ::set-output name=val::$name
@@ -130,8 +189,13 @@ jobs:
193+ mkdir -p runtime/grammars/sources
194+ tar xJf grammars/grammars.tar.xz -C runtime/grammars/sources
133− rm -rf tmp
195+ rm -rf grammars
135 mkdir dist
199 mkdir dist
137 for dir in bins-* ; do
201 for dir in bins-* ; do
@@ -140,19 +204,22 @@ jobs:
140 exe=".exe"
204 exe=".exe"
142 pkgname=helix-$TAG-$platform
206 pkgname=helix-$TAG-$platform
143− mkdir tmp/$pkgname
207+ mkdir $pkgname
144− cp LICENSE README.md tmp/$pkgname
208+ cp $source/LICENSE $source/README.md $pkgname
145− mv bins-$platform/runtime tmp/$pkgname/
209+ mv bins-$platform/runtime $pkgname/
146− mv bins-$platform/hx$exe tmp/$pkgname
210+ mv bins-$platform/hx$exe $pkgname
147− chmod +x tmp/$pkgname/hx$exe
211+ chmod +x $pkgname/hx$exe
149 if [ "$exe" = "" ]; then
213 if [ "$exe" = "" ]; then
150− tar cJf dist/$pkgname.tar.xz -C tmp $pkgname
214+ tar cJf dist/$pkgname.tar.xz $pkgname
152− (cd tmp && 7z a -r ../dist/$pkgname.zip $pkgname)
216+ 7z a -r dist/$pkgname.zip $pkgname
220+ tar cJf dist/helix-$TAG-source.tar.xz -C $source .
156 - name: Upload binaries to release
223 - name: Upload binaries to release
157 uses: svenstaro/upload-release-action@v2
224 uses: svenstaro/upload-release-action@v2