From a1e023e240b989c580854ae0a9eaf4d36e8e31c1 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 30 Sep 2023 10:10:22 -0700 Subject: [PATCH] CI: filter ci by paths, docs ci test vs build, update PR template --- .github/PULL_REQUEST_TEMPLATE.md | 5 ++-- .github/workflows/docker-publish.yml | 11 +++++++-- .github/workflows/docs-publish.yml | 35 +++++++++++++++++++++++++--- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8b4f9cf6d..d79794270 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,7 @@ Please include a summary of the change. Screenshots and / or videos can also be *** Please see the development guidelines for new widgets: https://gethomepage.dev/en/more/development/#service-widget-guidelines *** If you do not follow these guidelines your PR will likely be closed without review. -New service widgets should include example(s) of relevant relevant API output as well as a PR to the docs for the new widget. +New service widgets should include example(s) of relevant relevant API output as well updates to the docs for the new widget. --> Closes # (issue) @@ -20,11 +20,12 @@ What type of change does your PR introduce to Homepage? - [ ] New service widget - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) +- [ ] Documentation only - [ ] Other (please explain) ## Checklist: -- [ ] If adding a service widget or a change that requires it, I have added corresponding documentation. +- [ ] If adding a service widget or a change that requires it, I have added corresponding documentation changes. - [ ] If adding a new widget I have reviewed the [guidelines](https://gethomepage.dev/en/more/development/#service-widget-guidelines). - [ ] If applicable, I have checked that all tests pass with e.g. `pnpm lint`. - [ ] If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers. diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 3a727e3a0..7f317ef63 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -12,8 +12,14 @@ on: branches: [ "main" ] # Publish semver tags as releases. tags: [ 'v*.*.*' ] + paths-ignore: + - 'docs/**' + - 'mkdocs.yml' pull_request: branches: [ "main" ] + paths-ignore: + - 'docs/**' + - 'mkdocs.yml' env: # Use docker.io for Docker Hub if empty @@ -24,7 +30,8 @@ env: jobs: build: - if: github.repository == 'benphelps/homepage' + name: Docker Build & Push + if: github.repository == 'benphelps/homepage' runs-on: self-hosted permissions: contents: read @@ -40,7 +47,7 @@ jobs: # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer - name: Install cosign - if: github.event_name != 'pull_request' + if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@main with: cosign-release: 'v1.13.1' # optional diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index 0c3627b66..bd14f9aa3 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -4,14 +4,43 @@ on: push: tags: [ 'v*.*.*' ] branches: ['main'] + paths: + - 'docs/**' + - 'mkdocs.yml' + pull_request: + paths: + - 'docs/**' + - 'mkdocs.yml' workflow_dispatch: permissions: contents: write jobs: + test: + name: Test Build + if: github.repository == 'benphelps/homepage' && github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: sudo apt-get install pngquant + - run: pip install mike + - run: pip install mkdocs-material + - name: Test Docs Build + run: MKINSIDERS=false mkdocs build deploy: - if: github.repository == 'benphelps/homepage' + name: Build & Deploy + if: github.repository == 'benphelps/homepage' && github.event_name != 'pull_request' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -40,10 +69,10 @@ jobs: git checkout gh-pages git pull origin gh-pages git checkout main - - name: Mike Deploy for Main + - name: Docs Deploy for Main if: github.ref == 'refs/heads/main' run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}} - - name: Mike Deploy for Tags + - name: Docs Deploy for Tags if: github.ref != 'refs/heads/main' run: MKINSIDERS=true mike deploy --update --push ${{github.ref_name}} latest env: