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
|
2023-10-12 22:37:39 +00:00
|
|
|
|
2023-10-11 22:13:12 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-10-12 22:37:39 +00:00
|
|
|
|
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-13 14:59:26 +00:00
|
|
|
key: ${{ runner.os }}-buildx-frontend-${{ gitea.sha }}
|
2023-10-12 20:33:04 +00:00
|
|
|
restore-keys: |
|
2023-10-13 14:59:26 +00:00
|
|
|
${{ runner.os }}-buildx-frontend-
|
2023-10-12 22:37:39 +00:00
|
|
|
|
|
|
|
- name: Login to Container Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: git.nerdcult.net/nerdcult
|
2023-10-12 23:03:52 +00:00
|
|
|
username: nerdcultbot
|
|
|
|
password: ${{ secrets.NerdcultBotToken }}
|
2023-10-12 22:37:39 +00:00
|
|
|
|
|
|
|
- name: Build and Push
|
2023-10-11 22:13:12 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2023-10-12 22:37:39 +00:00
|
|
|
env:
|
|
|
|
ACTIONS_RUNTIME_TOKEN: ''
|
2023-10-11 22:13:12 +00:00
|
|
|
with:
|
|
|
|
context: .
|
2023-10-12 22:37:39 +00:00
|
|
|
push: true
|
|
|
|
tags: git.nerdcult.net/nerdcult/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
|
2023-10-12 22:37:39 +00:00
|
|
|
|
2023-10-12 20:33:04 +00:00
|
|
|
- name: Rotate the cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
2023-10-12 22:37:39 +00:00
|
|
|
|
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
|