From 8e0559e6b64b3bbc500c3f88853b124124e857f7 Mon Sep 17 00:00:00 2001 From: Evan Dunbar Date: Thu, 26 Sep 2024 11:17:00 -0500 Subject: [PATCH] Create workflow to release zip file --- .github/workflows/release.yml | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3545a7e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: Build and Release Tree-sitter Grammar + +# Trigger on push to main branch or manually +on: + push: + branches: + - main + workflow_dispatch: # Allows manual triggering of the workflow + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '22' # or the version you need + + - name: Install dependencies + run: npm install + + - name: Run build step + run: npm run build + + - name: Create an archive of the repository with build artifacts + run: | + zip -r release.zip ./* + + - name: Upload release zip as an artifact + uses: actions/upload-artifact@v3 + with: + name: tree-sitter-grammar-release + path: release.zip + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download the artifact + uses: actions/download-artifact@v3 + with: + name: tree-sitter-grammar-release + + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ github.run_number }} + release_name: Release v${{ github.run_number }} + draft: false + prerelease: false + + - name: Upload zip file to GitHub release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./tree-sitter-grammar-release.zip + asset_name: tree-sitter-grammar-release.zip + asset_content_type: application/zip +