-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created automated release and push to Docker Hub workflow
- Loading branch information
1 parent
eedfd95
commit befca3d
Showing
2 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Release Workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
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: | | ||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | ||
PATCH=$((PATCH + 1)) | ||
NEW_VERSION="$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 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 | ||
with: | ||
tag_name: ${{ env.new_version }} | ||
release_name: "Release ${{ env.new_version }}" | ||
body: "Automated release." | ||
draft: false | ||
prerelease: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.0 |