Skip to content

Fix version incrementation in build workflow #6

Fix version incrementation in build workflow

Fix version incrementation in build workflow #6

name: CD | Build-Test-Release
on:
push:
branches:
- "main"
release:
types: [published]
workflow_dispatch:
inputs:
image_tag:
description: "Docker Image Tag"
required: false
default: "dev"
jobs:
docker-build:
runs-on: ubuntu-latest
# DO is a custom runner deployed on DigitalOcean, only available for workflows under the runpod-workers organization.
# If you would like to use this workflow, you can replace DO with ubuntu-latest or any other runner.
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Read current version
id: read_version
run: echo "::set-output name=version::$(cat version.txt)"
- name: Increment version
id: increment_version
run: echo "::set-output name=next_version::$(echo "${{ steps.read_version.outputs.version }}" | awk -F '.' '{print $1"."$2"."$3+1}')"
- name: Save incremented version
run: echo "${{ steps.increment_version.outputs.next_version }}" > version.txt
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build and push step
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ vars.DOCKERHUB_REPO }}/${{ vars.DOCKERHUB_IMG }}:${{ steps.increment_version.outputs.next_version }}