1.3.11 #14
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: Harness Worker Image | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "Dockerfile" | |
| - "harness/**" | |
| - "src/**" | |
| - "pyproject.toml" | |
| - "poetry.lock" | |
| - ".github/workflows/harness-image.yml" | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| deploy: | |
| description: "Dispatch downstream deploy after the image is built" | |
| type: boolean | |
| default: true | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Calculate branch tag | |
| id: vars | |
| shell: bash | |
| run: | | |
| BRANCH="${{ github.ref_name }}" | |
| CLEANED_BRANCH_NAME=$(echo "$BRANCH" | tr '/' '-' | tr '[:upper:]' '[:lower:]') | |
| echo "cleaned-branch-name=$CLEANED_BRANCH_NAME" >> "$GITHUB_OUTPUT" | |
| - name: Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/conductor-oss/python-sdk/harness-worker | |
| tags: | | |
| type=raw,value=${{ steps.vars.outputs.cleaned-branch-name }}-latest,enable=${{ github.event_name != 'release' }} | |
| type=raw,value=${{ github.event.release.tag_name }},enable=${{ github.event_name == 'release' }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| target: harness | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| # Registry-backed BuildKit cache. Unchanged layers are reused across | |
| # runs so rebuilding the same commit (or one with only minor diffs) | |
| # is near-instant. The `:buildcache` tag lives alongside the image | |
| # but only stores layer blobs, not a runnable image. | |
| cache-from: type=registry,ref=ghcr.io/conductor-oss/python-sdk/harness-worker:buildcache | |
| cache-to: type=registry,ref=ghcr.io/conductor-oss/python-sdk/harness-worker:buildcache,mode=max | |
| dispatch-deploy: | |
| if: | | |
| github.event_name == 'release' || | |
| (github.event_name == 'workflow_dispatch' && inputs.deploy) | |
| needs: build-and-push | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: peter-evans/repository-dispatch@v3 | |
| with: | |
| token: ${{ secrets.CI_UTIL_DISPATCH_TOKEN }} | |
| repository: conductor-oss/oss-ci-util | |
| event-type: sdk_release | |
| client-payload: |- | |
| {"tag": "${{ github.event.release.tag_name || 'latest' }}", "repo": "${{ github.repository }}"} |