2023-10-11 21:12:37 +00:00
|
|
|
name: Build and Deploy
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "master"
|
|
|
|
paths-ignore:
|
|
|
|
- "**.md"
|
|
|
|
|
2023-10-11 21:40:31 +00:00
|
|
|
jobs:
|
|
|
|
build-docker:
|
2023-10-12 17:56:23 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-10-11 21:12:37 +00:00
|
|
|
steps:
|
2023-10-11 22:13:12 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-10-12 20:33:04 +00:00
|
|
|
- name: Cache Docker layers
|
|
|
|
uses: https://github.com/actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
2023-10-12 20:40:00 +00:00
|
|
|
/tmp/.buildx-cache
|
2023-10-12 20:33:04 +00:00
|
|
|
key: ${{ runner.os }}-buildx-${{ gitea.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-buildx-
|
2023-10-11 22:13:12 +00:00
|
|
|
- name: Build
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
load: true
|
|
|
|
tags: nerdcult_frontend:latest
|
2023-10-12 20:33:04 +00:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
|
|
|
- name: Rotate the cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
2023-10-12 18:46:15 +00:00
|
|
|
- name: Deploy
|
2023-10-12 22:19:47 +00:00
|
|
|
env:
|
|
|
|
TOWER_TOKEN: ${{ secrets.WatchtowerToken}}
|
|
|
|
TOWER_URI: ${{ secrets.WatchtowerURI}}
|
2023-10-11 21:12:37 +00:00
|
|
|
run: |
|
2023-10-12 22:19:47 +00:00
|
|
|
curl -H "Authorization: Bearer $TOWER_TOKEN" $TOWER_URI
|