diff --git a/.github/workflows/update-mod.yml b/.github/workflows/update-mod.yml new file mode 100644 index 0000000..2082b5e --- /dev/null +++ b/.github/workflows/update-mod.yml @@ -0,0 +1,42 @@ +name: Update Mod from CurseForge + +on: + schedule: + - cron: '0 0 * * *' # Runs at midnight once a day + workflow_dispatch: # Enables manual triggering + +jobs: + update-mod: + runs-on: ubuntu-24.04 # Explicitly specify ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Create package.json + run: | + echo '{"type": "module"}' > package.json # Add "type": "module" + + - name: Install dependencies + run: npm install curseforge-api node-fetch + + - name: Fetch latest server files + env: + CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} + run: node fetch_latest_server_files.js + + - name: Commit and push changes + env: + USER_NAME: ${{ secrets.USER_NAME }} + USER_EMAIL: ${{ secrets.USER_EMAIL }} + run: | + git config --global user.name $USER_NAME + git config --global user.email $USER_EMAIL + git add -A + git commit -m 'Update launch.sh and Dockerfile with latest server file info' + git push