Update Plugin via API - seastan/dragncards GitHub Wiki

There are multiple methods for updating your plugin via API:

From the Command Line

  1. Update your plugin on DragnCards to include the GitHub URL to your repository.
  2. Open a room for your plugin.
  3. Open a terminal on your computer and navigate to your local repository for your plugin.
  4. Run the following command, replacing <JSON_DIRECTORY> and <GITHUB_REPO_URL> as needed.

tar -czf jsons.tar.gz <JSON_DIRECTORY>; curl -X POST https://beta.dragncards.com/api/plugin-repo-update -F "repo_url=<GITHUB_REPO_URL>" -F "[email protected]";

This will create an archive of your json files and send them to DragnCards. Note that this method allows for your jsons to be stored in a deeply nested directory structure if you prefer to organize them that way (it will search through the whole structure for json files).

For example, for the dragncards-lotrlcg-plugin, for steps 3 & 4 I would do:

cd dragncards-lotrlcg-plugin

tar -czf jsons.tar.gz jsons; curl -X POST https://beta.dragncards.com/api/plugin-repo-update -F "repo_url=https://github.com/seastan/dragncards-lotrlcg-plugin" -F "[email protected]";```
  1. In your open DragnCards room, a message will appear that an update has been received, and you can press a hotkey to refresh your plugin and your game with the latest changes. Check out the hotkey menu for another hotkey that will enable the refreshes to trigger automatically. These messages only appear to plugin creators - other players with open rooms will not notice an update and will not be able to refresh your plugin.

This method also works for local instances of the DragnCards website. If you are running DragnCards locally, just replace with https://beta.dragncards.com with http://localhost:4000.

Via GitHub actions

  1. Update your plugin on DragnCards to include the GitHub URL to your repository.
  2. Open a room for your plugin.
  3. Add the following file to your repository at .github/workflows/update-notify.yml
name: Notify server on update

on:
  push:
    branches:
      - main

jobs:
  notify:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Archive JSON files
        run: tar -czf jsons.tar.gz jsons

      - name: Print REPO_URL for debugging
        env:
          REPO_URL: ${{ github.event.repository.html_url }}
        run: echo "REPO_URL is set to ${REPO_URL}"

      - name: Send files to server
        env:
          REPO_URL: ${{ github.event.repository.html_url }}
        run: |
          curl -X POST https://beta.dragncards.com/api/plugin-repo-update \
               -H 'Content-Type: multipart/form-data' \
               -F "repo_url=${REPO_URL}" \
               -F "[email protected]"

(If you don't store your jsons in a directory called "jsons", you will need to modify the "Archive JSON files" command).

  1. Go to your repository settings on github.com, click on Actions->General->Allow all actions
  2. Now, whenever you push to your repository, or edit your repository through GitHub's online editor, a message will appear in your open DragnCards room that an update has been received, and you can press a hotkey to refresh your plugin and your game with the latest changes. Check out the hotkey menu for another hotkey that will enable the refreshes to trigger automatically. These messages only appear to plugin creators - other players with open rooms will not notice an update and will not be able to refresh your plugin.