frontend/.gitea/workflows/deploy.yml

57 lines
1.5 KiB
YAML
Raw Permalink Normal View History

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:
- name: Checkout
uses: actions/checkout@v4
2023-10-12 22:37:39 +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
key: ${{ runner.os }}-buildx-frontend-${{ gitea.sha }}
2023-10-12 20:33:04 +00:00
restore-keys: |
${{ 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
username: nerdcultbot
password: ${{ secrets.NerdcultBotToken }}
2023-10-12 22:37:39 +00:00
- name: Build and Push
uses: docker/build-push-action@v5
2023-10-12 22:37:39 +00:00
env:
ACTIONS_RUNTIME_TOKEN: ''
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