Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: ncine addon #193

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/metadata.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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
64 changes: 7 additions & 57 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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/[email protected]
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/[email protected]
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
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions addons/ncine/info.json
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions addons/ncine/module
Submodule module added at 1d0d69
Loading