imnya.ng/.github/workflows/main.yml
imnyang 349a6fed63 chore(ci): correct GHCR image tags in GitHub Actions workflow
Replace ghcr.io/imnyang/choten tags with ghcr.io/imnyang/imnya.ng to use the repository's actual image name when building and pushing Docker images.
2025-10-23 20:43:11 +09:00

51 lines
1.3 KiB
YAML

on:
push:
branches:
- main
workflow_dispatch:
name: Web Build
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set version
run: |
if [[ "${GITHUB_REF}" == refs/heads/main ]]; then
echo "RELEASE_VERSION=latest" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/imnyang/imnya.ng:latest
ghcr.io/imnyang/imnya.ng:${{ github.run_id }}
update:
runs-on: self-hosted
steps:
- name: Pull and restart container
run: |
docker-compose -f /home/neko/Git/imnya.ng/compose.yml pull web
docker-compose -f /home/neko/Git/imnya.ng/compose.yml up -d web
needs: build