feat: if this works add docker layer caching for faster builds #35
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: Build and Deploy | |
on: | |
# Runs only when master is updated | |
push: | |
branches: [ "master" ] | |
# Allows manually running this workflow from the Actions Tab | |
workflow_dispatch: | |
# Allow only one concurrent deployment, skips runs queued between the current | |
# run and latest queued. We don't cancel in progress to allow for the current | |
# run to finish deploying to production. | |
concurrency: | |
group: "production" | |
cancel-in-progress: false | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Build with Docker | |
run: docker compose up --build | |
- name: Setup SSH keys | |
run: | | |
mkdir -p ~/.ssh | |
echo '${{ secrets.SSH_PRIV_KEY }}' > ~/.ssh/id_ed25519 | |
chmod 400 ~/.ssh/id_ed25519 | |
echo '${{ secrets.SSH_HOST_KEY }}' > ~/.ssh/known_hosts | |
chmod 400 ~/.ssh/known_hosts | |
- name: Deploy with rsync | |
run: | | |
rsync --archive --verbose --compress --partial --checksum --progress \ | |
--human-readable --delete --exclude=static --exclude=archives \ | |
_site/ [email protected]:/home/d/de/decal/public_html | |