name: Tag submodules on release

on:
  create:
    tags: ["v*"]

permissions:
  contents: write

jobs:
  tag-all-submodules:
    runs-on: ubuntu-latest
    name: Tag all submodules
    steps:
      -
        name: Create Beego tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/beego/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Caddy tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/caddy/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Chi tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/chi/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Dotweb tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/dotweb/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Echo tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/echo/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Fiber tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/fiber/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Gin tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/gin/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Go-zero tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/go-zero/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Goa tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/goa/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Goyave tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/goyave/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Hertz tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/hertz/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Kratos tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/kratos/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Roadrunner tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/roadrunner/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Skipper tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/skipper/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Souin tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/souin/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Traefik tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/traefik/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Tyk tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/tyk/${{ github.ref_name }}',
              sha: context.sha
            })
      -
        name: Create Webgo tag
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.git.createRef({
              owner: context.repo.owner,
              repo: context.repo.repo,
              ref: 'refs/tags/plugins/webgo/${{ github.ref_name }}',
              sha: context.sha
            })
