From 5f25f6d7ea2ab0ccc6e2b718bbeaaaf1bb7b5606 Mon Sep 17 00:00:00 2001 From: Kristijan Husak Date: Thu, 22 Aug 2024 11:25:24 +0200 Subject: [PATCH] ci: Set up dev and tag luarocks release workflow (#801) --- .github/workflows/luarocks.yml | 21 ++++++---------- .github/workflows/luarocks_dev.yml | 39 ------------------------------ .github/workflows/release.yml | 31 ++++++++++++++++++++++++ .github/workflows/release_dev.yml | 16 ++++++++++++ .github/workflows/tests.yml | 7 +----- 5 files changed, 56 insertions(+), 58 deletions(-) delete mode 100644 .github/workflows/luarocks_dev.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/release_dev.yml diff --git a/.github/workflows/luarocks.yml b/.github/workflows/luarocks.yml index 1dcda01b4..a9ed775f2 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 a2a3b0b27..000000000 --- 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 000000000..35505ea7b --- /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 000000000..30e724746 --- /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 3b457f083..8350bb59b 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