Update structures.yml #156
This file contains 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: Export and compile structures | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
compile-structures: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- name: Install JSDoc | |
run: npm install -g jsdoc | |
- name: Compile structures | |
run: | | |
for file in $(find ./src/structures -name '*.js'); | |
do | |
echo "Compiling $file" | |
jsdoc -X $file > src/structures/compiled/$(basename "$file").json | |
done | |
output="// This file is automatically generated. Do not edit.\n" | |
for file in $(find ./src/structures/compiled -name '*.json'); | |
do | |
echo "Adding file to export $file" | |
output="$output import $(basename $file .js.json) from './structures/compiled/$(basename $file)' assert { type: 'json' };\n" | |
done | |
output="$output export default {\n" | |
for file in $(find ./src/structures/compiled -name '*.json'); | |
do | |
echo "Adding file to export $file" | |
output="$output $(basename $file .js.json),\n" | |
done | |
output="$output };" | |
echo -e $output > ./src/compiledStructures.js | |
- name: Export structures | |
run: | | |
output="// This file is automatically generated. Do not edit.\n" | |
for file in $(find ./src/structures -name '*.js'); | |
do | |
echo "Adding file to export $file" | |
output="$output export \* as $(basename $file .js) from './structures/$(basename $file)';\n" | |
done | |
for file in $(find ./src/managers -name '*.js'); | |
do | |
echo "Adding file to export $file" | |
output="$output export \* as $(basename $file .js) from './managers/$(basename $file)';\n" | |
done | |
echo -e $output > ./src/structures.js | |
- name: Import bot's GPG key for signing commits | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v4 | |
with: | |
gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "src" | |
committer_email: [email protected] | |
committer_name: Starman |