forked from DerekStride/tree-sitter-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02e73e7
commit a7ae4e6
Showing
2 changed files
with
109 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
|
||
|
||
name: Create Release | ||
|
||
on: | ||
push: | ||
branch: | ||
- gh_release_build_experimenting | ||
tags: | ||
- release_test | ||
|
||
build: | ||
name: Build Code | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] | ||
include: | ||
- arch: x86_64 | ||
os: ubuntu-latest | ||
- arch: macos_arm64 | ||
os: macos-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
# We need emscripten to build the wasm file | ||
- name: Install Emscripten | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y emscripten | ||
- name: Install Emscripten | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
brew install emscripten | ||
- name: Build Code | ||
run: | | ||
npm install nan # why? it is a indirect dependency already, yet it cannot be found | ||
npm install | ||
npm run build | ||
zip -r tree-sitter-sql-${{ matrix.arch }}.zip src sql.so tree-sitter-sql.wasm # TODO: add version name | ||
tar -czvf tree-sitter-sql-${{ matrix.arch }}.tar.gz src sql.so grammar.js tree-sitter-sql.wasm # TODO: add version name | ||
- name: upload zip | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tree-sitter-sql-${{ matrix.arch }} | ||
path: tree-sitter-sql-${{ matrix.arch }}.* | ||
retention-days: 1 | ||
overwrite: true | ||
|
||
publish_artifacts: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_REPO: ${{ github.repository }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
|
||
- if: github.event_name == 'release' | ||
run: | | ||
TAG_NAME=${{ github.ref }} | ||
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV | ||
- name: Generate Linux Zip SHA256 checksums | ||
run: | | ||
cd tree-sitter-sql-x86_64 | ||
sha256sum tree-sitter-sql-x86_64.zip > tree-sitter-sql-x86_64.zip.sha256sum | ||
echo "SHA_LINUX_64_ZIP=$(cat tree-sitter-sql-x86_64.zip.sha256sum)" >> $GITHUB_ENV | ||
- name: Generate Linux Tar SHA256 checksums | ||
run: | | ||
cd tree-sitter-sql-x86_64 | ||
sha256sum tree-sitter-sql-x86_64.tar.gz > tree-sitter-sql-x86_64.tar.gz.sha256sum | ||
echo "SHA_LINUX_64_TAR=$(cat tree-sitter-sql-x86_64.tar.gz.sha256sum)" >> $GITHUB_ENV | ||
- name: Generate MacOS Zip SHA256 checksums | ||
run: | | ||
cd tree-sitter-sql-macos_arm64 | ||
sha256sum tree-sitter-sql-macos_arm64.zip > tree-sitter-sql-macos_arm64.zip.sha256sum | ||
echo "SHA_MACOS_ARM64_ZIP=$(cat tree-sitter-sql-macos_arm64.zip.sha256sum)" >> $GITHUB_ENV | ||
- name: Generate MacOS Tar SHA256 checksums | ||
run: | | ||
cd tree-sitter-sql-macos_arm64 | ||
sha256sum tree-sitter-sql-macos_arm64.tar.gz > tree-sitter-sql-macos_arm64.tar.gz.sha256sum | ||
echo "SHA_MACOS_ARM64_TAR=$(cat tree-sitter-sql-macos_arm64.tar.gz.sha256sum)" >> $GITHUB_ENV | ||
- name: Publish release | ||
run: | | ||
echo $GITHUB_ENV | ||
echo $(git describe --tags --abbrev=0) | ||
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md" | ||
gh release create $(git describe --tags --abbrev=0) --notes-file "$RUNNER_TEMP/notes.md" --target $GITHUB_SHA tree-sitter-sql-x86_64/tree-sitter-sql-x86_64.* tree-sitter-sql-macos_arm64/tree-sitter-sql-macos_arm64.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters