Skip to content

Fixed indentation in workflow file #24

Fixed indentation in workflow file

Fixed indentation in workflow file #24

Workflow file for this run

name: Release Workflow
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build-push-release:
runs-on: ubuntu-latest
environment: Release Authentication
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3
# Read the current version
- name: Read Current Version
id: version
run: |
VERSION=$(cat VERSION)
echo "Current Version: $VERSION"
echo "version=$VERSION" >> $GITHUB_ENV
# Increment the patch version
- name: Increment Patch Version
id: increment
run: |
VERSION=$(cat VERSION || echo "0.0.0") # Fallback to "0.0.0" if VERSION is empty
VERSION=${VERSION#v} # Remove leading 'v' if it exists
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
MAJOR=${MAJOR:-0} # Default to 0 if MAJOR is missing
MINOR=${MINOR:-0} # Default to 0 if MINOR is missing
PATCH=${PATCH:-0} # Default to 0 if PATCH is missing
PATCH=$((PATCH + 1))
NEW_VERSION="v$MAJOR.$MINOR.$PATCH"
echo "New Version: $NEW_VERSION"
echo "$NEW_VERSION" > VERSION
echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
# Commit the new version
- name: Commit Updated Version
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add VERSION
git commit -m "Bump version to ${{ env.new_version }}"
git push origin HEAD:main
# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Build and push Docker image
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: |
chrismuntean/handify:latest
chrismuntean/handify:${{ env.new_version }}
# Create GitHub Release
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.new_version }}
release_name: "${{ env.new_version }}"
body: "Automated release."
draft: false
prerelease: false