mirror of
https://github.com/karl0ss/ai_image_frame_server.git
synced 2025-05-25 22:55:17 +01:00
revery workflow
This commit is contained in:
parent
7dd90bb032
commit
cd5306814c
50
.github/workflows/docker-publish.yml
vendored
50
.github/workflows/docker-publish.yml
vendored
@ -1,55 +1,47 @@
|
||||
name: Build, Update Version and Publish Docker Image
|
||||
name: Build and Publish Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['*']
|
||||
tags: ['*'] # triggers on any tag push
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install bump2version
|
||||
run: pip install bump2version
|
||||
|
||||
# Bump patch version, commit, and push back to repo (only on main branch)
|
||||
- name: Bump version and push
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
bump2version patch --allow-dirty
|
||||
git push origin main --follow-tags
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Registry
|
||||
run: echo "${{ secrets.PASSWORD }}" | docker login ${{ secrets.REGISTRY }} -u "${{ secrets.USERNAME }}" --password-stdin
|
||||
|
||||
- name: Get version from file
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=$(python -c "import myproject.__version__ as v; print(v.__version__)")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and Push Docker Images
|
||||
run: |
|
||||
IMAGE_NAME="ai-frame-image-server"
|
||||
REGISTRY="${{ secrets.REGISTRY }}"
|
||||
USERNAME="${{ secrets.USERNAME }}"
|
||||
VERSION="${{ steps.get_version.outputs.version }}"
|
||||
IMAGE_TAG="$REGISTRY/$USERNAME/$IMAGE_NAME:$VERSION"
|
||||
IMAGE_LATEST="$REGISTRY/$USERNAME/$IMAGE_NAME:latest"
|
||||
|
||||
echo "🔧 Building $IMAGE_TAG"
|
||||
docker build -t $IMAGE_TAG .
|
||||
# Always build and tag as latest
|
||||
echo "🔧 Building $IMAGE_LATEST"
|
||||
docker build -t $IMAGE_LATEST .
|
||||
|
||||
echo "📤 Pushing $IMAGE_TAG"
|
||||
docker push $IMAGE_TAG
|
||||
echo "📤 Pushing $IMAGE_LATEST"
|
||||
docker push $IMAGE_LATEST
|
||||
|
||||
# If this is a tag push, tag the image accordingly
|
||||
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
||||
GIT_TAG="${GITHUB_REF#refs/tags/}"
|
||||
IMAGE_TAGGED="$REGISTRY/$USERNAME/$IMAGE_NAME:$GIT_TAG"
|
||||
|
||||
echo "🏷️ Also tagging as $IMAGE_TAGGED"
|
||||
docker tag $IMAGE_LATEST $IMAGE_TAGGED
|
||||
|
||||
echo "📤 Pushing $IMAGE_TAGGED"
|
||||
docker push $IMAGE_TAGGED
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user