diff --git a/.github/workflows/metadata.yml b/.github/workflows/metadata.yml new file mode 100644 index 00000000..fff466c7 --- /dev/null +++ b/.github/workflows/metadata.yml @@ -0,0 +1,62 @@ +name: Fetch Addon Metadata + +on: + pull_request_review: + types: [submitted] + +jobs: + metadata: + if: ${{ github.event.review.state == 'approved' }} + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + name: Checkout LLS-Addons + with: + submodules: false + + - name: Fetch Base Branch + run: | + # Fetch all history for the base branch and PR head + git fetch origin ${{ github.base_ref }} --depth=1 + git fetch origin ${{ github.head_ref }} --depth=1 + + - name: Detect Added Submodules + run: | + BASE_REF=${{ github.event.pull_request.base.sha }} + HEAD_REF=${{ github.event.pull_request.head.sha }} + + ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..${HEAD_REF} | grep '^Submodule' | awk '{ print $2 }') + echo "Added submodules: $ADDED_SUBMODULES" + echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV + + - name: Fetch submodules + run: | + for submodule in $ADDED_SUBMODULES; do + echo "Getting submodule: $submodule" + git submodule update --init --recursive $submodule + done + + # Custom action that gets metadata on each addon + - uses: dsaltares/fetch-gh-release-asset@1.1.0 + name: Get submodule metadata fetching action + with: + token: ${{ secrets.GITHUB_TOKEN }} + repo: LuaLS/LLS-Addons-Action + file: dist.zip + target: action.zip + - name: Unzip custom action + run: unzip action.zip -d action + - uses: ./action/dist + name: Get Addon Metadata + + # Commit new metadata + - name: Commit Metadata + uses: stefanzweifel/git-auto-commit-action@v4.16.0 + with: + commit_message: "chore: Update Addon Metadata" + file_pattern: addons/*/info.json + commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + commit_user_name: github-actions[bot] + commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ac097a06..9fca0378 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -17,14 +17,16 @@ jobs: - name: Fetch Base Branch run: | - git fetch origin ${GITHUB_BASE_REF} - git checkout ${GITHUB_BASE_REF} + # Fetch all history for the base branch and PR head + git fetch origin ${{ github.base_ref }} --depth=1 + git fetch origin ${{ github.head_ref }} --depth=1 - name: Detect Added Submodules run: | - BASE_REF=${{github.event.pull_request.base.sha}} - git checkout $BASE_REF - ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..HEAD | grep '^Submodule' | awk '{ print $2 }') + BASE_REF=${{ github.event.pull_request.base.sha }} + HEAD_REF=${{ github.event.pull_request.head.sha }} + + ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..${HEAD_REF} | grep '^Submodule' | awk '{ print $2 }') echo "Added submodules: $ADDED_SUBMODULES" echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV @@ -41,55 +43,3 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} version: latest args: --check addons - - metadata: - name: "Fetch Addon Metadata" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - name: Checkout LLS-Addons - with: - submodules: false - - - name: Fetch Base Branch - run: | - git fetch origin ${GITHUB_BASE_REF} - git checkout ${GITHUB_BASE_REF} - - - name: Detect Added Submodules - run: | - BASE_REF=${{github.event.pull_request.base.sha}} - git checkout $BASE_REF - ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..HEAD | grep '^Submodule' | awk '{ print $2 }') - echo "Added submodules: $ADDED_SUBMODULES" - echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV - - - name: Fetch submodules - run: | - for submodule in $ADDED_SUBMODULES; do - echo "Getting submodule: $submodule" - git submodule update --init --recursive $submodule - done - - # Custom action that gets metadata on each addon - - uses: dsaltares/fetch-gh-release-asset@1.1.0 - name: Get submodule metadata fetching action - with: - token: ${{ secrets.GITHUB_TOKEN }} - repo: LuaLS/LLS-Addons-Action - file: dist.zip - target: action.zip - - name: Unzip custom action - run: unzip action.zip -d action - - uses: ./action/dist - name: Get Addon Metadata - - # Commit new metadata - - name: Commit Metadata - uses: stefanzweifel/git-auto-commit-action@v4.16.0 - with: - commit_message: "chore: Update Addon Metadata" - file_pattern: addons/*/info.json - commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - commit_user_name: github-actions[bot] - commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com diff --git a/.gitmodules b/.gitmodules index 96914632..117285be 100644 --- a/.gitmodules +++ b/.gitmodules @@ -202,3 +202,7 @@ [submodule "addons/scribunto/module"] path = addons/scribunto/module url = https://github.com/Dianliang233/scribunto-addon +[submodule "addons/ncine/module"] + path = addons/ncine/module + url = https://github.com/nCine/nCine-LuaCATS + branch = addon diff --git a/addons/ncine/info.json b/addons/ncine/info.json new file mode 100644 index 00000000..c4b3adfc --- /dev/null +++ b/addons/ncine/info.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/LLS-Addons/main/schemas/addon_info.schema.json", + "name": "nCine", + "description": "Definitions for the nCine, a cross-platform 2D game framework with an emphasis on performance" +} diff --git a/addons/ncine/module b/addons/ncine/module new file mode 160000 index 00000000..1d0d690e --- /dev/null +++ b/addons/ncine/module @@ -0,0 +1 @@ +Subproject commit 1d0d690ea462c6df20b70c0f3b0a76a30de10a50