modify workflow
This commit is contained in:
parent
32e4210584
commit
1bd78a6d49
1 changed files with 46 additions and 0 deletions
46
.forgejo/workflows/deploy.yml
Normal file
46
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
skyjo-name: Build, Push and Deploy
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
|
||||
env:
|
||||
REGISTRY: git.pb1497.com
|
||||
IMAGE_NAME: pb/skyjo-fe
|
||||
# Wir nutzen hier den internen Namen des DinD Containers für Docker-Befehle
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: https://data.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Login to Forgejo Registry
|
||||
run: |
|
||||
# Erstelle ein "App-Passwort" in Forgejo unter Einstellungen -> Anwendungen
|
||||
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login ${{ env.REGISTRY }} -u "${{ github.actor }}" --password-stdin
|
||||
|
||||
- name: Build and Push Image
|
||||
run: |
|
||||
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest .
|
||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
deploy:
|
||||
needs: build-and-push
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy Container
|
||||
run: |
|
||||
# Einloggen auf dem Host-Runner (falls nötig)
|
||||
docker login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
# Altes Image ziehen und Container neu starten
|
||||
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
# Falls du ein docker-compose.yml im Repo hast:
|
||||
# docker compose up -d --force-recreate
|
||||
|
||||
# Oder einfacher Docker-Run (Beispiel):
|
||||
docker stop skyjo-fe || true
|
||||
docker rm skyjo-fe || true
|
||||
docker run -d --name skyjo-fe --network swag_net ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
Loading…
Reference in a new issue