diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..32d285de --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release Workflow + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Build artifacts + run: npm install && npm run build && stat tree-sitter-sql.wasm + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.get_version.outputs.VERSION }} + release_name: Release ${{ steps.get_version.outputs.VERSION }} + draft: true + prerelease: false + + - name: Upload Release Asset + id: upload_release_asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./tree-sitter-sql.wasm + asset_name: tree-sitter-sql.wasm + asset_content_type: application/octet-stream diff --git a/.gitignore b/.gitignore index d7854daa..cab061c1 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ package-lock.json /src/tree_sitter/ /src/parser.c /src/*.json +tree-sitter-sql.wasm +a.out.js +a.out.wasm diff --git a/package-lock.json b/package-lock.json index fcbff648..157b9397 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@derekstride/tree-sitter-sql", - "version": "0.1.1", + "version": "0.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@derekstride/tree-sitter-sql", - "version": "0.1.1", + "version": "0.2.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e795b83c..683df909 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "scripts": { "test": "tree-sitter test", "install": "tree-sitter generate && node-gyp rebuild", - "release": "commit-and-tag-version" + "release": "commit-and-tag-version", + "build-wasm": "tree-sitter build-wasm", + "build": "npm run build-wasm" }, "author": "derek stride", "license": "MIT",