name: Atlas
# Atlas checks if a modules atlas manifest has been touched, if so it publishes the updated version
on:
  push:
    branches:
      - master
    paths:
      - "x/**/atlas/*"
  pull_request:
    paths:
      - "x/**/atlas/*"

jobs:
  auth:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v4
        id: git_diff
        with:
          PATTERNS: |
            x/auth/atlas/**
      - uses: marbar3778/atlas_action@main
        with:
          token: ${{ secrets.ATLAS_TOKEN }}
          path: ./x/auth/atlas/atlas.toml
          dry-run: ${{ github.event_name != 'pull_request' }}
        if: env.GIT_DIFF
  bank:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v4
        id: git_diff
        with:
          PATTERNS: |
            x/bank/atlas/**
      - uses: marbar3778/atlas_action@main
        with:
          token: ${{ secrets.ATLAS_TOKEN }}
          path: ./x/bank/atlas/atlas.toml
          dry-run: ${{ github.event_name != 'pull_request' }}
        if: env.GIT_DIFF
  evidence:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-diff-action@v4
        id: git_diff
        with:
          PATTERNS: |
            x/evidence/atlas/**
      - uses: marbar3778/atlas_action@main
        with:
          token: ${{ secrets.ATLAS_TOKEN }}
          path: ./x/evidence/atlas/manifest.toml
          dry-run: ${{ github.event_name != 'pull_request' }}
        if: env.GIT_DIFF
