Skip to content

Commit

Permalink
Automatically build release on tag push (Wilfred#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
J3RN authored Jan 29, 2022
1 parent 9ce6b3c commit 8df19a5
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: release
on:
push:
tags:
- "v*"

jobs:
build-release:
name: build-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v2
with:
node-version: "14.x"

- name: Install npm dependencies
run: npm ci

- name: Ensure generated parser files are up to date
run: npx tree-sitter generate

- name: Ensure tests pass
run: npx tree-sitter test

- name: Compile library file
run: cc -shared -fPIC -g -O2 -I src src/parser.c -o tree-sitter-gleam.so

- name: Create archive
run: |
VERSION="${GITHUB_REF#refs/tags/}"
case ${{ matrix.os }} in
"ubuntu-latest") FAMILY="linux";;
"macos-latest") FAMILY="macos";;
esac
ARCHIVE="tree-sitter-gleam-$VERSION-$FAMILY.tar.gz"
tar -czf $ARCHIVE tree-sitter-gleam.so
echo "ASSET=$ARCHIVE" >> $GITHUB_ENV
- name: Upload release archive
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
fail_on_unmatched_files: true
files: |
${{ env.ASSET }}

0 comments on commit 8df19a5

Please sign in to comment.