release: v1.3.0 #17
Workflow file for this run
This file contains hidden or 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
| name: Build and Push Docker Image | |
| on: | |
| push: | |
| tags: ['v*'] # Release builds (triggered by release workflow) | |
| workflow_dispatch: # Manual trigger for :dev or ad-hoc builds | |
| env: | |
| IMAGE_NAME: kleverapp/mcp-klever-vm | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_REGISTRY_USER }} | |
| password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.IMAGE_NAME }} | |
| tags: | | |
| # Dev builds: manual dispatch from develop branch | |
| type=raw,value=dev,enable=${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/develop' }} | |
| type=raw,value=dev-{{sha}},enable=${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/develop' }} | |
| # Release builds: semver tags | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
| # Latest only for non-prerelease semver tags | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-') }} | |
| # Ad-hoc builds: manual dispatch from non-develop branches | |
| type=raw,value=sha-{{sha}},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/develop' }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| GIT_SHA=${{ github.sha }} | |
| BUILD_TIME=${{ github.event.head_commit.timestamp || github.event.repository.updated_at }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |