feat: deploy via forgejo actions
Some checks failed
Build and Deploy Go App / build (push) Failing after 2m26s
Build and Deploy Go App / deploy (push) Has been skipped

This commit is contained in:
nihonium 2025-10-08 01:10:57 +03:00
parent a5605262b3
commit b46d0e5010
Signed by: nihonium
GPG key ID: 0251623741027CFC
4 changed files with 45 additions and 45 deletions

View file

@ -4,54 +4,42 @@ on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: docker
container:
image: golang:1.25.0
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Go app
run: |
cd modules/server
go mod tidy
go build -o nyanimedb .
- name: Build Docker image
run: docker build -t nyanimedb:latest .
- name: Save Docker image artifact
run: docker save nyanimedb:latest -o nyanimedb.tar
- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: docker-image
path: nyanimedb.tar
run: |
cd modules/server
docker build -t nyanimedb:latest .
deploy:
runs-on: docker
runs-on: self-hosted
needs: build
if: ${{ github.event.inputs.deploy == 'true' }} # manual deploy trigger
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: nyanimedb
POSTGRES_PORT: 5432
POSTGRES_VERSION: 18
LOG_LEVEL: ${{ vars.LOG_LEVEL }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download image
uses: actions/download-artifact@v4
with:
name: docker-image
path: .
- name: Load Docker image
run: docker load -i nyanimedb.tar
- name: Deploy container locally
- name: Deploy containers locally
run: |
echo "Deploying nyanimedb locally..."
docker stop nyanimedb || true
docker rm nyanimedb || true
docker run -d --name nyanimedb -p 8080:8080 nyanimedb:latest
cd deploy
docker compose down || true
docker compose up -d

View file

@ -1,6 +0,0 @@
on: [push]
jobs:
test:
runs-on: docker
steps:
- run: echo All Good