From a0f83afe3b86930ffb084a8085299bd36e757df9 Mon Sep 17 00:00:00 2001 From: Wang Rongfei Date: Sat, 20 Apr 2024 20:20:48 +0800 Subject: [PATCH] ci: add ability to release via ci --- .github/workflows/build.yml | 21 +++++++++++---------- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a725e96..f5146c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build on: push: branches: [master] + workflow_call: jobs: windows-x86_64: @@ -33,12 +34,12 @@ jobs: - name: Build run: >- sh make.sh lua_tree_sitter.dll ${{ matrix.editor.make_opts }} && - mv lua-tree-sitter/lua_tree_sitter.dll init.dll + mv lua-tree-sitter/lua_tree_sitter.dll ${{ matrix.editor.name }}-tree-sitter.x86_64-windows.dll - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: ${{ matrix.editor.name }}-tree-sitter-x86_64-windows - path: init.dll + name: ${{ matrix.editor.name }}-tree-sitter.x86_64-windows + path: ${{ matrix.editor.name }}-tree-sitter.x86_64-windows.dll if-no-files-found: error linux: @@ -64,16 +65,16 @@ jobs: with: submodules: recursive - name: Install cc - run: sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get install make ${{ matrix.arch.cc }} + run: sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get install make ${{ matrix.arch.pkg }} - name: Build run: >- sh make.sh lua_tree_sitter.so CC=${{ matrix.arch.cc }} ${{ matrix.editor.make_opts }} && - mv lua-tree-sitter/lua_tree_sitter.so init.so + mv lua-tree-sitter/lua_tree_sitter.so ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-linux.so - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: ${{ matrix.editor.name }}-tree-sitter-${{ matrix.arch.name }}-linux - path: init.so + name: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-linux + path: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-linux.so if-no-files-found: error macos: @@ -99,10 +100,10 @@ jobs: - name: Build run: >- bash make.sh lua_tree_sitter.so ${{ matrix.arch.make_opts }} ${{ matrix.editor.make_opts }} && - mv lua-tree-sitter/lua_tree_sitter.so init.so + mv lua-tree-sitter/lua_tree_sitter.so ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-darwin.so - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: ${{ matrix.editor.name }}-tree-sitter-${{ matrix.arch.name }}-darwin - path: init.so + name: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-darwin + path: ${{ matrix.editor.name }}-tree-sitter.${{ matrix.arch.name }}-darwin.so if-no-files-found: error diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..68e9046 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release + +on: + workflow_dispatch: + inputs: + tag: + description: Release tag + required: true + type: string + +jobs: + build: + name: Build binaries + uses: ./.github/workflows/build.yml + release: + name: Upload release + needs: build + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + - name: Upload artifacts to release + uses: ncipollo/release-action@v1 + with: + artifacts: "lite-xl-tree-sitter.*/*,pragtical-tree-sitter.*/*" + tag: ${{ inputs.tag }} + commit: master + allowUpdates: true