Skip to content

Commit

Permalink
fix github workflow cache
Browse files Browse the repository at this point in the history
  • Loading branch information
copdips committed Dec 11, 2023
1 parent 677b0b8 commit a56239e
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,50 @@ jobs:
docs
- name: Set up Python runtime
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: |
requirements.txt
- name: Set up build cache
uses: actions/cache/restore@v3
- name: Get pip cache dir
run: |
os_version=$(cat /etc/os-release | grep -i "version=" | cut -c9- | tr -d '"' | tr ' ' '_')
github_workflow_full_path="${GITHUB_WORKFLOW_REF%@*}"
python_full_version=$(python -c 'import platform; print(platform.python_version())')
node_major_version=$(node --version | cut -d'.' -f1 | tr -d 'v')
echo "os_version=$os_version" >> $GITHUB_ENV
echo "github_workflow_full_path=$github_workflow_full_path" >> $GITHUB_ENV
echo "python_full_version=$python_full_version" >> $GITHUB_ENV
echo "PIP_CACHE_DIR=$(pip cache dir)" >> $GITHUB_ENV
- name: cache pip
uses: actions/cache@v3
with:
key: mkdocs-material-${{ hashfiles('.cache/**') }}
path: .cache
restore-keys: |
mkdocs-material-
path: ${{ env.pythonLocation }}
key: ${{ env.github_workflow_full_path}}-${{ env.os_version }}-${{ env.python_full_version }}-${{ env.node_major_version}}-${{ hashFiles('requirements.txt') }}

# - name: Set up build cache
# uses: actions/cache/restore@v3
# with:
# key: mkdocs-material-${{ hashfiles('.cache/**') }}
# path: .cache
# restore-keys: |
# mkdocs-material-

- name: Install dependencies
run: sudo apt-get install pngquant

- name: Install Python dependencies
run: |
pip install -U pip
pip install -r requirements.txt
pip install -U -r requirements.txt
pip install mkdocs-material[recommended,git,imaging]
- name: Build documentation
# env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
mkdocs build --clean
mkdocs build -s
mkdocs --version
# - name: Adjust permissions
Expand All @@ -75,8 +90,8 @@ jobs:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v2

- name: Save build cache
uses: actions/cache/save@v3
with:
key: mkdocs-material-${{ hashfiles('.cache/**') }}
path: .cache
# - name: Save build cache
# uses: actions/cache/save@v3
# with:
# key: mkdocs-material-${{ hashfiles('.cache/**') }}
# path: .cache

0 comments on commit a56239e

Please sign in to comment.