Skip to content

feat: Update GitHub workflows for automated releases and versioning #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/Main Cuda Docker Build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Main CUDA Docker Build

on:
push:
branches:
- main # Only trigger on pushes to the main branch
release:
types: [published]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

Expand All @@ -24,17 +26,24 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Build and push scriberr:main-gpu Docker image
- name: Build and push CUDA Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
file: ./Dockerfile-cuda128
tags: |
ghcr.io/rishikanthc/scriberr:main-cuda128

ghcr.io/rishikanthc/scriberr:${{ steps.version.outputs.version }}-cuda128
ghcr.io/rishikanthc/scriberr:latest-cuda128

- name: Verify multi-platform image for scriberr:main-gpu
- name: Verify multi-platform image
run: |
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:main-cuda128
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:${{ steps.version.outputs.version }}-cuda128
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:latest-cuda128
25 changes: 17 additions & 8 deletions .github/workflows/Main Docker Build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Main Docker Build

on:
push:
branches:
- main # Only trigger on pushes to the main branch
release:
types: [published]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

Expand All @@ -24,17 +26,24 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Build and push scriberr:main Docker image
- name: Build and push CPU Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
file: ./Dockerfile
tags: |
ghcr.io/rishikanthc/scriberr:main

ghcr.io/rishikanthc/scriberr:${{ steps.version.outputs.version }}
ghcr.io/rishikanthc/scriberr:latest

- name: Verify multi-platform image for scriberr:main
- name: Verify multi-platform image
run: |
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:latest
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:${{ steps.version.outputs.version }}
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:latest
14 changes: 9 additions & 5 deletions .github/workflows/Nightly Cuda Docker Build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
name: Nightly CUDA Docker Build

on:
push:
pull_request:
types: [closed]
branches:
- nightly # Only trigger on pushes to the nightly branch
- nightly

jobs:
docker:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

Expand All @@ -25,7 +30,7 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push scriberr:nightly-gpu Docker image
- name: Build and push CUDA nightly image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
Expand All @@ -34,7 +39,6 @@ jobs:
tags: |
ghcr.io/rishikanthc/scriberr:nightly-cuda128


- name: Verify multi-platform image for scriberr:nightly-gpu
- name: Verify multi-platform image
run: |
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:nightly-cuda128
15 changes: 10 additions & 5 deletions .github/workflows/Nightly Docker Build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
name: Nightly Docker Build

on:
push:
pull_request:
types: [closed]
branches:
- nightly # Only trigger on pushes to the nightly branch
- nightly

jobs:
docker:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache

Expand All @@ -25,7 +30,7 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push scriberr:nightly Docker image
- name: Build and push CPU nightly image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
Expand All @@ -34,6 +39,6 @@ jobs:
tags: |
ghcr.io/rishikanthc/scriberr:nightly

- name: Verify multi-platform image for scriberr:nightly
- name: Verify multi-platform image
run: |
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:nightly
docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:nightly
58 changes: 0 additions & 58 deletions .github/workflows/actions-release.yml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/version-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Create Release

on:
pull_request:
types: [closed]
branches:
- main

jobs:
create-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Determine new version
id: version
run: |
CURRENT_VERSION="0.3.0"
# Check commit messages to determine version increment
COMMITS=$(git log $(git describe --tags --abbrev=0 2>/dev/null || echo HEAD~10)..HEAD --pretty=format:"%s")

MAJOR_CHANGE=false
MINOR_CHANGE=false
PATCH_CHANGE=true # Default to patch if no specific keywords found

echo "$COMMITS" | while read -r commit; do
if [[ "$commit" == *"BREAKING CHANGE"* || "$commit" == *"!:"* ]]; then
MAJOR_CHANGE=true
break
elif [[ "$commit" =~ ^feat(\([^)]+\))?:.* ]]; then
MINOR_CHANGE=true
fi
done

IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"

if [ "$MAJOR_CHANGE" = true ]; then
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
elif [ "$MINOR_CHANGE" = true ]; then
MINOR=$((MINOR + 1))
PATCH=0
else
PATCH=$((PATCH + 1))
fi

NEW_VERSION="$MAJOR.$MINOR.$PATCH"
echo "New version: $NEW_VERSION"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "release_tag=v$NEW_VERSION" >> $GITHUB_OUTPUT

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.release_tag }}
release_name: Release ${{ steps.version.outputs.release_tag }}
draft: false
prerelease: false
body: |
Release ${{ steps.version.outputs.release_tag }}

Changes in this release:
${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }})