diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml index 1dcda01b..a9ed775f 100644 --- a/.github/workflows/luarocks.yml +++ b/.github/workflows/luarocks.yml @@ -1,24 +1,19 @@ name: Push to Luarocks on: - push: - tags: - - '*' - release: - types: - - created - pull_request: # Runs test install without uploading - workflow_dispatch: # Allows to trigger manually + workflow_call: + inputs: + luarocks_version: + type: string + required: true jobs: - luarocks-upload: + upload: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 # Required to count the commits - - name: Get Version - run: echo "LUAROCKS_VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV + fetch-depth: 0 - name: Install C/C++ Compiler uses: rlalik/setup-cpp-compiler@master with: @@ -41,6 +36,6 @@ jobs: env: LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} with: - version: ${{ env.LUAROCKS_VERSION }} + version: ${{ inputs.luarocks_version }} dependencies: | tree-sitter-orgmode ~> 1 diff --git a/.github/workflows/luarocks_dev.yml b/.github/workflows/luarocks_dev.yml deleted file mode 100644 index a2a3b0b2..00000000 --- a/.github/workflows/luarocks_dev.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Push dev to Luarocks - -on: - push: - branches: - - master - -jobs: - luarocks-upload: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Required to count the commits - - name: Install C/C++ Compiler - uses: rlalik/setup-cpp-compiler@master - with: - compiler: clang-latest - - name: Install tree-sitter CLI - uses: baptiste0928/cargo-install@v3 - with: - crate: tree-sitter-cli - - name: Install Lua - uses: leso-kn/gh-actions-lua@master - with: - luaVersion: "5.1" - - name: Install Luarocks - uses: hishamhm/gh-actions-luarocks@master - - name: Install `luarocks-build-treesitter-parser` Package - run: | - luarocks --verbose --local --lua-version=5.1 install luarocks-build-treesitter-parser - - name: LuaRocks Upload - uses: nvim-neorocks/luarocks-tag-release@v7 - env: - LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} - with: - version: "dev" - dependencies: | - tree-sitter-orgmode ~> 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..35505ea7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Push release to Luarocks + +on: + push: + tags: + - '*' + release: + types: + - created + workflow_dispatch: + +jobs: + tests: + uses: ./.github/workflows/tests.yml + version: + needs: tests + runs-on: ubuntu-latest + outputs: + luarocks_version: ${{ steps.get_version.outputs.LUAROCKS_VERSION }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required to count the commits + - name: Get Version + id: get_version + run: echo "LUAROCKS_VERSION=$(git describe --abbrev=0 --tags)" >> $GITHUB_OUTPUT + luarocks: + needs: version + uses: ./.github/workflows/luarocks.yml + with: + luarocks_version: ${{ needs.version.outputs.luarocks_version }} diff --git a/.github/workflows/release_dev.yml b/.github/workflows/release_dev.yml new file mode 100644 index 00000000..30e72474 --- /dev/null +++ b/.github/workflows/release_dev.yml @@ -0,0 +1,16 @@ +name: dev + +on: + push: + branches: + - master + pull_request: # Luarocks upload only tests installation + +jobs: + tests: + uses: ./.github/workflows/tests.yml + luarocks_dev: + needs: tests + uses: ./.github/workflows/luarocks.yml + with: + luarocks_version: dev diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3b457f08..8350bb59 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,12 +1,7 @@ name: tests on: - push: - branches: - - master - pull_request: - branches: - - master + workflow_call: env: CI: true