forked from Wilfred/difftastic
-
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.
Automatically build release on tag push (Wilfred#11)
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 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,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 }} |