Initial commit with gitea actions
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
REGISTRY: git.test
|
||||
IMAGE: git.test/torscha/sveltekit-app:latest
|
||||
DEPLOY_PATH: /opt/apps/sveltekit-app
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login $REGISTRY \
|
||||
-u "${{ secrets.REGISTRY_USER }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t $IMAGE .
|
||||
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
docker push $IMAGE
|
||||
|
||||
- name: Deploy on Raspberry Pi
|
||||
uses: appleboy/ssh-action@v1.2.0
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
port: 2222
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
script: |
|
||||
cd $DEPLOY_PATH
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
docker image prune -f
|
||||
Reference in New Issue
Block a user