Harness Worker Image #12
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/**" | |
| - "Conductor/**" | |
| - ".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/csharp-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: Debug CONDUCTOR_SERVER_URL | |
| run: echo "CONDUCTOR_SERVER_URL=${{ secrets.CONDUCTOR_SERVER_URL }}" | sed 's/http/xxhttpxx/g' | |
| - 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 }} | |
| dispatch-deploy: | |
| if: 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 }}"} |