name: 'Import markers from Spenceron'

on:
  workflow_dispatch

jobs:
  import-markers:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.head_ref }}
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version-file: '.nvmrc'
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Import markers
        env:
          URL: ${{secrets.MARKERS_URL_SPENCERON}}
        run: |
          mkdir -p minimap
          curl --silent --location --output minimap/minimapmarkers.bin "${URL}"
          node_modules/.bin/tibia-maps --from-minimap=minimap --output-dir=data --markers-only
          git config user.name 'Mathias Bynens'
          git config user.email 'mathias@qiwi.be'
          git commit data/markers.json -m 'Import marker changes from Spenceron’s client'
          git push

Set up marker import for Spenceron
Set up marker import for Spenceron