Files
chore/.gitea/workflows/build.yaml
Ryan Kegel fc364621e3
All checks were successful
Chore App Build and Push Docker Images / build-and-push (push) Successful in 12s
modify gitea
2026-02-11 00:04:44 -05:00

64 lines
2.6 KiB
YAML

name: Chore App Build and Push Docker Images
run-name: ${{ gitea.actor }} is building the chore app 🚀
on:
push:
branches:
- master
- next
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Determine Image Tag
id: vars
run: |
version=$(python -c "import sys; sys.path.append('./backend'); from config.version import BASE_VERSION; print(BASE_VERSION)")
current_date=$(date +%Y%m%d)
if [ "${{ gitea.ref }}" == "refs/heads/master" ]; then
echo "tag=$version" >> $GITHUB_OUTPUT
else
echo "tag=next-$version-$current_date" >> $GITHUB_OUTPUT
fi
- name: Resolve Gitea Server IP
id: gitea_ip
run: |
ip=$(getent hosts gitea-server | awk '{ print $1 }')
echo "ip=$ip" >> $GITHUB_OUTPUT
echo "Resolved Gitea server IP: $ip"
- name: Build Backend Docker Image
run: |
docker build -t ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/backend:${{ steps.vars.outputs.tag }} ./backend
- name: Build Frontend Docker Image
run: |
docker build -t ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/frontend:${{ steps.vars.outputs.tag }} ./frontend/vue-app
- name: Log in to Registry
uses: docker/login-action@v2
with:
registry: ${{ steps.gitea_ip.outputs.ip }}:3000
username: ryan #${{ secrets.REGISTRY_USERNAME }} # Stored as a Gitea secret
password: 0x013h #${{ secrets.REGISTRY_TOKEN }} # Stored as a Gitea secret (use a PAT here)
- name: Push Backend Image to Gitea Registry
run: |
docker push ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/backend:${{ steps.vars.outputs.tag }}
if [ "${{ gitea.ref }}" == "refs/heads/master" ]; then
docker tag ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/backend:${{ steps.vars.outputs.tag }} ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/backend:latest
docker push ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/backend:latest
fi
- name: Push Frontend Image to Gitea Registry
run: |
docker push ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/frontend:${{ steps.vars.outputs.tag }}
if [ "${{ gitea.ref }}" == "refs/heads/master" ]; then
docker tag ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/frontend:${{ steps.vars.outputs.tag }} ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/frontend:latest
docker push ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/frontend:latest
fi