name: Find and Replace Page Deployment

on:
  push:
    branches: [ page ]
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - name: Initiate - Page
      uses: actions/checkout@v3
      with:
        token: ${{ secrets.PAT }}
        ref: page

    - name: Find and Replace - Page
      run: |
        find -not -path './.git*' -type f -exec sed -i 's/app-dev.geo.ca/app.geo.ca/g' {} \;
        find -not -path './.git*' -type f -exec sed -i 's/dev.geo.ca/canadian-geospatial-platform.github.io\/geo.ca/g' {} \;
        find -not -path './.git*' -type f -exec sed -i 's/geocore-dev.api.geo.ca/geocore.api.geo.ca/g' {} \;
    
    - name: Push changes - Page
      uses: stefanzweifel/git-auto-commit-action@v4
      with:
        commit_message: Automated Commit - Page
        push_options: --force
        branch: page