Skip to content

Commit

Permalink
pacakge: for debian and plain old zip and tar (amd64)
Browse files Browse the repository at this point in the history
  • Loading branch information
stackmystack committed May 14, 2024
1 parent 73ad988 commit 31ce99a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Prepare git # To get tags from `git describe`
run: git fetch --prune --unshallow
- name: Bundle all parsers
run: |
./package/deb
./package/zip
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
31 changes: 31 additions & 0 deletions package/deb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# /usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

version_num=$(git describe --tags --abbrev=0 | sed -E 's/v([0-9]+\.[0-9]+)/\1/')
commit_count=$(git rev-list --count --first-parent HEAD)

version="$version_num.$commit_count"
echo

pkg='tree-sitter-parsers'
rm -rf "$pkg"

debian="$pkg/DEBIAN"
mkdir -p "$debian"

dst="$pkg/usr/local/lib"
mkdir -p "$dst"

cat <<-EOF > "$debian/control"
Package: $pkg
Version: $version
Architecture: amd64
Maintainer: Firas al-Khalil <firas.al-khalil@faveod.com>
Description: A bunch of tree-sitter parsers.
EOF

cp lib/libtree-sitter-*.so "$dst"
dpkg-deb --build "$pkg" "lib/$pkg.deb"

12 changes: 12 additions & 0 deletions package/zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# /usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

pkg='tree-sitter-parsers'
rm -rf "$pkg"
mkdir "$pkg"

cp lib/libtree-sitter-*.dylib "$pkg"
zip "lib/$pkg.zip" "$pkg"/libtree-sitter-*.dylib
tar -cvzf "lib/$pkg.tar.gz" "$pkg"/libtree-sitter-*.dylib

0 comments on commit 31ce99a

Please sign in to comment.