Skip to content

fix: fix permission issue with pushing tags #2

fix: fix permission issue with pushing tags

fix: fix permission issue with pushing tags #2

name: Build and Push Docker Image
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Get the version
id: get_version
run: |
# Get the latest tag
git fetch --tags
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
# Increment the patch version
version=$(echo $latest_tag | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
echo "New version: $version"
echo "VERSION=$version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_USER }}/vllm-huggingface:latest
${{ secrets.DOCKER_USER }}/vllm-huggingface:${{ steps.get_version.outputs.VERSION }}
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git config user.name github-actions
git config user.email [email protected]
git tag ${{ steps.get_version.outputs.VERSION }}
git push origin ${{ steps.get_version.outputs.VERSION }}