Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Optimize Deploy Site workflow #558

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,35 @@ 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)
files_changed=$(git diff --name-only $previous_commit $latest_commit |
grep -E '\.(html|css|js|png|md|rst)$') || true

if [ -z "$files_changed" ]; then
echo "No relevant changes detected."
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Content changes detected:"
echo "$files_changed"
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
python -m pip install --upgrade pip
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
Expand All @@ -50,15 +70,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 }}
Expand Down