-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (111 loc) · 3.65 KB
/
release.yaml
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
name: Release
on:
schedule:
- cron: 0 0 */7 * *
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
pull_request:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: windows-latest
artefact: windows-x86_64
- runs-on: ubuntu-latest
artefact: linux-x86_64
- runs-on: macos-14
artefact: macos-aarch64
- runs-on: macos-13
artefact: macos-x86_64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Ubuntu dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get -y update
sudo apt-get -y install curl wget clang pkg-config
sudo update-alternatives --set cc /usr/bin/clang
- name: Install tree-sitter-cli
run: |
cargo install tree-sitter-cli@^0.22 --locked
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Build grammars
if: always()
run: mkdir ./output && mkdir ./tmp && cargo run --release -- --output ./output --tmp ./tmp
- name: Create tarball
run: |
tar -C ./output -cvf ./${{ matrix.artefact }}.tar .
zstd ./${{ matrix.artefact }}.tar -o ./grammars-${{ matrix.artefact }}.tar.zst
- name: Create queries
if: runner.os == 'Linux'
run: |
cp ./tmp/helix/LICENSE ./tmp/helix/runtime/queries/helix.LICENSE
tar -C ./tmp/helix/runtime/queries -cvf ./queries.tar .
zstd ./queries.tar -o ./queries.tar.zst
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.artefact }}
path: |
./grammars-${{ matrix.artefact }}.tar.zst
retention-days: 3
- uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: queries
path: |
./queries.tar.zst
retention-days: 3
release:
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'push'
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@v4
with:
path: ./artefacts
merge-multiple: true
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" | tee -a $GITHUB_ENV
- if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
name: Re-Tag nightly
run: |
gh release delete nightly --yes || true
git push origin :nightly || true
- name: Create release (nightly)
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
run: |
gh release create \
--prerelease \
--title Nightly \
--target $GITHUB_SHA \
nightly \
./artefacts/*.zst
- name: Create release (tag)
if: github.event_name == 'push'
env:
RELEASE_TAG: ${{ github.ref }}
run: |
gh release create \
--title ${RELEASE_TAG#refs/tags/} \
--target $GITHUB_SHA \
${RELEASE_TAG#refs/tags/} \
./artefacts/*.zst