[update] Setting Up a Private Docker Registry with LKE and Object Sto… #569
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Tests | |
on: | |
push: | |
branches: | |
- develop | |
env: | |
hugo-image-cache-name: hugo-generated-images | |
hugo-image-cache-path: /home/runner/work/docs/docs/resources/_gen/images/ | |
repo-name: docs | |
repo-owner: linode | |
jobs: | |
cache-images: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: List contents of images dir | |
continue-on-error: true | |
run: ls -al ${{ env.hugo-image-cache-path }} | |
- name: Cache images dir | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.hugo-image-cache-path }} | |
key: ${{ env.hugo-image-cache-name }}-${{ github.run_id }} | |
restore-keys: | | |
${{ env.hugo-image-cache-name }} | |
- name: List contents of images dir | |
continue-on-error: true | |
run: ls -al ${{ env.hugo-image-cache-path }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10.x' | |
architecture: 'x64' | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('./ci/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./ci/requirements.txt | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '14.x' | |
- name: Install dependencies (Node) | |
run: npm install | |
- name: Set up Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.111.3' | |
- name: Build Hugo | |
run: hugo --gc | |
- name: List existing Hugo image caches | |
run: | | |
curl \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ env.repo-owner }}/${{ env.repo-name }}/actions/caches?key=${{ env.hugo-image-cache-name }} \ | |
-o cache-list.json | |
echo "The following caches will be deleted:" | |
cat cache-list.json | |
- name: Delete existing Hugo image caches | |
run: | | |
for id in $(jq '.actions_caches[].id' cache-list.json); do | |
echo "Deleting cache with id $id" | |
curl \ | |
-X DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/${{ env.repo-owner }}/${{ env.repo-name }}/actions/caches/$id | |
done |