diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6090f8fc0..9fb7bb587 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,17 +1,7 @@ --- name: Build Documentation -# We don't want pushes (or PRs) to gh-pages to kick anything off on: - push: - branches: [main] - paths: - - tests/* - - hydromt/* - - data/* - - docs/* - - examples/* - - pyproject.toml pull_request: branches: [main] paths: @@ -23,7 +13,6 @@ on: - pyproject.toml jobs: - # Build docs on Linux Docs: name: linux docs runs-on: ubuntu-latest @@ -56,7 +45,7 @@ jobs: - uses: actions/cache@v2 with: path: /usr/share/miniconda3/envs/hydromt - key: ${{ matrix.python-version }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} + key: docs-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }} id: cache - name: Update environment @@ -74,7 +63,7 @@ jobs: run: echo "DOC_VERSION=$(python -c 'from hydromt import __version__ as v; print("dev" if "dev" in v else "v"+v.replace(".dev",""))')" >> $GITHUB_ENV - name: Upload to GitHub Pages - if: ${{ github.event_name != 'pull_request' && !github.event.act }} + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true && !github.event.act }} uses: peaceiris/actions-gh-pages@v3.8.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 14c55ff60..df87d698a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,12 +12,8 @@ on: schedule: - cron: '0 0 * * *' -env: - CACHE_NUMBER: 0 # increase to reset cache manually - jobs: build: - defaults: run: shell: bash -l {0} @@ -27,6 +23,9 @@ jobs: python-version: ['3.9','3.10','3.11'] name: py ${{ matrix.python-version }} runs-on: ${{ matrix.os }} + concurrency: + group: ${{ github.workflow }}-${{ matrix.python-version }}-${{ github.ref }} + cancel-in-progress: true steps: - uses: actions/checkout@v3 @@ -48,7 +47,7 @@ jobs: - uses: actions/cache@v2 with: path: /usr/share/miniconda3/envs/hydromt - key: ${{ matrix.python-version }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} + key: ${{ matrix.python-version }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }} id: cache - name: Update environment @@ -62,7 +61,3 @@ jobs: - name: Upload code coverage if: github.event_name != 'schedule' uses: codecov/codecov-action@v3 - -# concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true