From 1689e7c49a345ea1d94aed971bb27181317e408c Mon Sep 17 00:00:00 2001 From: Wojciech Pietraszewski Date: Wed, 7 Aug 2024 15:29:14 +0200 Subject: [PATCH] test gha --- .github/workflows/deploy-site.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index c914e6532b..ccf839af60 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -15,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# +## name: Deploy Site on: push @@ -29,21 +29,25 @@ jobs: - uses: actions/checkout@v3 with: ref: master + fetch-depth: 2 - name: Check For Content Changes + id: check_changes run: | latest_commit=$(git rev-parse HEAD) previous_commit=$(git rev-parse HEAD~1) - content_changed=$(git diff --name-only $previous_commit $latest_commit | grep -E '\.(html|css|js|py|md|rst)$') + content_changed=$(git diff --name-only $previous_commit $latest_commit | grep -E '\.(html|css|js|py|md|rst)$') || true if [ -z "$content_changed" ]; then echo "No relevant changes detected." - exit 0 + echo "changed=false" >> $GITHUB_OUTPUT else echo "Relevant changes detected." + echo "changed=true" >> $GITHUB_OUTPUT fi - name: Install Dependencies + if: steps.check_changes.outputs.changed == 'true' run: | sudo apt-get update sudo apt-get install -y doxygen tzdata @@ -51,6 +55,7 @@ jobs: pip install -r requirements.txt - name: Setup Project + if: steps.check_changes.outputs.changed == 'true' run: | cd .. git clone https://github.com/apache/mynewt-documentation @@ -60,15 +65,19 @@ jobs: git clone https://github.com/apache/mynewt-newtmgr - name: Build Site + if: steps.check_changes.outputs.changed == 'true' run: ./build.py - name: Fetch Deployment Branch + if: steps.check_changes.outputs.changed == 'true' run: git fetch origin asf-site:asf-site - name: Deploy Site + if: steps.check_changes.outputs.changed == 'true' run: ./deploy.sh build - name: Create Pull Request + if: steps.check_changes.outputs.changed == 'true' uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }}