Update Resource Database #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Resource Database | |
on: | |
workflow_dispatch: | |
jobs: | |
update-resources: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out main repo | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PUSH_KEY }} | |
- name: Install Lua, LuaRocks, and lsqlite3 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y lua5.1 lua5.1-dev libsqlite3-dev build-essential unzip curl | |
# Install LuaRocks manually (latest stable) | |
curl -R -O https://luarocks.org/releases/luarocks-3.9.2.tar.gz | |
tar zxpf luarocks-3.9.2.tar.gz | |
cd luarocks-3.9.2 | |
./configure --lua-version=5.1 --with-lua-include=/usr/include/lua5.1 | |
make | |
sudo make install | |
cd .. | |
# Install lsqlite3 | |
sudo luarocks install lsqlite3 | |
- name: Clone Windower/Resources outside workspace | |
run: | | |
git clone https://github.com/Windower/Resources.git /tmp/resources_data | |
- name: Run Lua script with lsqlite3 | |
run: | | |
luarocks exec -- lua resources/scripts/generate_items.lua /tmp/resources_data/items.lua | |
- name: Configure Git | |
run: | | |
git config --global user.name 'cyrite' | |
git config --global user.email '[email protected]' | |
- name: Commit and push changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git add . | |
git commit -m "Updating resource database" | |
git push | |
else | |
echo "No changes to commit." | |
fi |