Skip to content

Release

Release #315

Workflow file for this run

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
sudo update-alternatives --set c++ /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