Skip to content

config related modifications #250

config related modifications

config related modifications #250

Workflow file for this run

name: Build and Deploy to Dockerhub
on:
push:
branches:
- auth_rbac
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 frontend image
run: |
docker build -t mdv-frontend:${{ env.NEW_VERSION }} -f Dockerfile .
docker tag mdv-frontend:${{ env.NEW_VERSION }} ${{ secrets.DOCKER_HUB_USERNAME }}/mdv-frontend:${{ env.NEW_VERSION }}
docker tag mdv-frontend:${{ env.NEW_VERSION }} ${{ secrets.DOCKER_HUB_USERNAME }}/mdv-frontend:latest
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/mdv-frontend:${{ env.NEW_VERSION }}
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/mdv-frontend: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 }}