Working base server with migrations and build steps ironed out (#1)

Reviewed-on: #1
Co-authored-by: Joseph Nelson <joseph.nelson4456@gmail.com>
Co-committed-by: Joseph Nelson <joseph.nelson4456@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
2026-05-13 23:16:20 -07:00
committed by joseph.nelson4456
parent 12922c35bf
commit ce914f91fd
16 changed files with 323 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
# Check if the lint fix command fails
# If it does, exit with a non-zero status to prevent the commit.
echo "Running lint fix..."
# Replace with your actual lint fix command
# This is just an example, adapt it to your linter and project
npm run lint:fix # e.g., "eslint . --fix"
# Example: Capture the exit code of the command
lint_fix_result=$?
if [ $lint_fix_result -ne 0 ]; then
echo "Linting failed. Commit aborted."
exit 1 # Exit with a non-zero status to prevent the commit
fi
echo "Lint fix completed successfully. Commit allowed."
exit 0 # Exit with a zero status to allow the commit
+39
View File
@@ -0,0 +1,39 @@
name: Build and Push Image
on:
pull_request:
branches:
- main
types: [closed]
jobs:
build-and-push:
if: gitea.event.pull_request.merged == true
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Log in to Gitea Registry
uses: docker/login-action@v2
with:
registry: gitea.nelson-household.com # Replace with your Gitea domain
username: ${{ gitea.actor }}
password: ${{ secrets.RUNNER_TOKEN }}
- name: Delete Old Images and Containers
run: |
docker ps -a -q -f "name=tcg-collectors-server" | xargs -I {} docker rm {} || true
docker images --format "{{.Repository}}:{{.Tag}}" | grep "tcg-collectors-server" | xargs -I {} docker rmi {} || true
- name: Build and Push Image
run: |
docker build \
--build-arg DATABASE_URL=${{ secrets.DATABASE_URL }} \
-t gitea.nelson-household.com/hard-at-work/tcg-collectors-server/tcg-collectors-server:${{ github.sha }} .
docker push gitea.nelson-household.com/hard-at-work/tcg-collectors-server/tcg-collectors-server:${{ github.sha }}
- name: Execute Migrations
run: |
docker run gitea.nelson-household.com/hard-at-work/tcg-collectors-server/tcg-collectors-server:${{ github.sha }} npm run migrate up