name: Deploy CI
on:
  release:
    types: [created]
  workflow_dispatch:
jobs:
  upload:
    name: Upload to CDN
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: BetaHuhn/do-spaces-action@master
        with:
          access_key: ${{ secrets.ACCESS_KEY}}
          secret_key: ${{ secrets.SECRET_KEY }}
          space_name: ${{ secrets.SPACE_NAME }}
          space_region: ${{ secrets.SPACE_REGION }}
          source: "dist/drkmd-js.min.js"
          out_dir: "dist/drkmd-js"
          versioning: true
  purge:
    name: Purge JSDelivr
    runs-on: ubuntu-latest
    steps:
      - name: Send Purge request to JSDelivr
        run: curl https://purge.jsdelivr.net/npm/drkmd-js/dist/drkmd-js.min.js