Cache snapcraft, but move the cache data into ~/ first

This commit is contained in:
Micah Lee 2022-10-05 17:42:42 -07:00
parent c6b61a852a
commit c41a13e404
No known key found for this signature in database
GPG key ID: 403C2657CD994F73

View file

@ -318,12 +318,26 @@ jobs:
- name: Restore cache - snapcraft
uses: actions/cache@v3
with:
path: /root/.cache/snapcraft
path: ~/snapcraft-cache
key: snapcraft-cache
- name: Move cache from home to root
run: |
mkdir -p /root/.cache
if [[ -d "~/snapcraft-cache" ]]; then
mv ~/snapcraft-cache /root/.cache/snapcraft
chown -R root:root /root/.cache/snapcraft
echo "moved cache from home to root"
fi
- name: Build snap
run: sudo snapcraft --use-lxd
- name: Move cache root to home
run: |
mv /root/.cache/snapcraft ~/snapcraft-cache
chown -R $USER:$USER ~/snapcraft-cache
- uses: actions/upload-artifact@v3
with:
name: snapcraft-build