Merge branch 'dev' into chat_update #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy to Dockerhub | |
on: | |
push: | |
branches: | |
- chat_update | |
paths-ignore: | |
- '**.github/workflows/**' # Ignore changes to workflow files | |
if: "contains(github.event.head_commit.message, '[deploy]')" | |
jobs: | |
build-and-push: | |
if: "contains(github.event.head_commit.message, '[deploy]')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Read current version | |
id: read_version | |
run: | | |
VERSION=$(cat version.txt) | |
echo "Current version: $VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Increment version | |
id: increment_version | |
run: | | |
NEW_VERSION=$(awk -F. '{print $1"."($2+1)}' version.txt) | |
echo "New version: $NEW_VERSION" | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
echo $NEW_VERSION > version.txt | |
- name: Build and push chatmdv image | |
run: | | |
docker build -t jayeshire/chatmdv:${{ env.NEW_VERSION }} -f Dockerfile-chat . | |
docker tag jayeshire/chatmdv:${{ env.NEW_VERSION }} jayeshire/chatmdv:latest | |
docker push jayeshire/chatmdv:${{ env.NEW_VERSION }} | |
docker push jayeshire/chatmdv:latest | |
- name: Commit and push new version | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add version.txt | |
git commit -m "Increment version to ${{ env.NEW_VERSION }} [skip ci]" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |