diff --git a/.github/workflows/Main Cuda Docker Build.yml b/.github/workflows/Main Cuda Docker Build.yml index 7a18741..9609728 100644 --- a/.github/workflows/Main Cuda Docker Build.yml +++ b/.github/workflows/Main Cuda Docker Build.yml @@ -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 @@ -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 \ No newline at end of file + docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:${{ steps.version.outputs.version }}-cuda128 + docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:latest-cuda128 \ No newline at end of file diff --git a/.github/workflows/Main Docker Build.yml b/.github/workflows/Main Docker Build.yml index fd8e8e1..60329e7 100644 --- a/.github/workflows/Main Docker Build.yml +++ b/.github/workflows/Main Docker Build.yml @@ -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 @@ -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 \ No newline at end of file diff --git a/.github/workflows/Nightly Cuda Docker Build.yml b/.github/workflows/Nightly Cuda Docker Build.yml index ef45c05..4c61570 100644 --- a/.github/workflows/Nightly Cuda Docker Build.yml +++ b/.github/workflows/Nightly Cuda Docker Build.yml @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/.github/workflows/Nightly Docker Build.yml b/.github/workflows/Nightly Docker Build.yml index 46c2f2a..ba742c1 100644 --- a/.github/workflows/Nightly Docker Build.yml +++ b/.github/workflows/Nightly Docker Build.yml @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/.github/workflows/actions-release.yml b/.github/workflows/actions-release.yml deleted file mode 100644 index b5653b5..0000000 --- a/.github/workflows/actions-release.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Release CI - -on: - release: - types: [published] - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Cache compiled binaries - # uses: actions/cache@v3 - # with: - # path: | - # /app/whisper.cpp - # /usr/local/bin/ - # /usr/local/share/man/man1/ - # /usr/local/share/man/man5/ - # key: ${{ runner.os }}-build-${{ hashFiles('Dockerfile') }} - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - platforms: linux/amd64,linux/arm64 - push: true - file: ./Dockerfile - tags: | - ghcr.io/rishikanthc/scriberr:${{ github.ref_name }} - # cache-from: | - # type=registry,ref=ghcr.io/rishikanthc/scriberr:${{ github.ref_name }}-linux-amd64 - # type=registry,ref=ghcr.io/rishikanthc/scriberr:${{ github.ref_name }}-linux-arm64 - # cache-to: | - # type=registry,ref=ghcr.io/rishikanthc/scriberr:${{ github.ref_name }}-linux-amd64,mode=max,compress=true - # type=registry,ref=ghcr.io/rishikanthc/scriberr:${{ github.ref_name }}-linux-arm64,mode=max,compress=true - - - name: Verify multi-platform image - run: | - docker buildx imagetools inspect ghcr.io/rishikanthc/scriberr:${{ github.ref_name }} - - - name: Push image to GHCR - run: | - docker buildx imagetools create \ - ghcr.io/rishikanthc/scriberr:${{ github.ref_name }} \ - --tag ghcr.io/rishikanthc/scriberr:${{ github.ref_name }} - diff --git a/.github/workflows/version-and-release.yml b/.github/workflows/version-and-release.yml new file mode 100644 index 0000000..416a313 --- /dev/null +++ b/.github/workflows/version-and-release.yml @@ -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 }}) \ No newline at end of file