Set auto config hint for empty polls #88
Workflow file for this run
This file contains 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: Docker Build & Push | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
release: | |
types: | |
- released | |
jobs: | |
# This job exposes image_tag and push_enabled variables for other jobs. | |
# Other jobs depends on this. see needs: meta in other jobs. | |
meta: | |
runs-on: ubuntu-latest | |
outputs: | |
image_tag: ${{ steps.determine-image-tag.outputs.image_tag }} | |
push_enabled: ${{ steps.determine-push.outputs.enabled }} | |
steps: | |
# this step determines the image tag based on the event that triggered the workflow. | |
# it sets the image_tag output variable to either "master" or the release version. | |
- name: Determine image tag | |
id: determine-image-tag | |
run: | | |
if [[ "${{ github.event_name }}" == "push" ]]; then | |
echo "image_tag=master" >> $GITHUB_OUTPUT | |
elif [[ "${{ github.event_name }}" == "release" ]]; then | |
echo "image_tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT | |
else | |
echo "image_tag=test" >> $GITHUB_OUTPUT | |
fi | |
# This step determines if push is enabled based on the event that triggered the workflow. Push is disabled on pull requests. | |
- name: Determine if push is enabled | |
id: determine-push | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
echo "enabled=false" >> $GITHUB_OUTPUT | |
else | |
echo "enabled=true" >> $GITHUB_OUTPUT | |
fi | |
# TODO: Delete below job below once image tags are validated after merging | |
check-meta: | |
needs: meta | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check meta | |
run: | | |
echo "Image tag: ${{ needs.meta.outputs.image_tag }}" | |
echo "Push enabled: ${{ needs.meta.outputs.push_enabled }}" | |
- name: This step should run if push is enabled | |
if: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
run: | | |
echo "Push enabled: ${{ needs.meta.outputs.push_enabled }}" | |
- name: This step should run if push is disabled | |
if: ${{ needs.meta.outputs.push_enabled == 'false' }} | |
run: | | |
echo "Push enabled: ${{ needs.meta.outputs.push_enabled }}" | |
- name: Double check dockerhub secrets | |
env: | |
user: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }} | |
pw: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }} | |
run: | | |
echo "Dockerhub username first chars: ${user:0:2}, last char: ${user: -1}" | |
echo "Dockerhub token first chars: ${pw:0:2}, last char: ${pw: -1}" | |
push_server_image: | |
name: Push server image to Docker Hub | |
needs: meta | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
if: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64 | |
build-args: TARGET=server | |
# TODO: Uncomment below once image tags are validated after merging | |
# push: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
push: false | |
tags: ubercadence/server:${{ needs.meta.outputs.image_tag }} | |
- name: Validate tag | |
run: | | |
echo "ubercadence/server:${{ needs.meta.outputs.image_tag }}" | |
push_server_auto_setup_image: | |
name: Push auto-setup image to Docker Hub | |
needs: meta | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
if: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64 | |
build-args: TARGET=auto-setup | |
# TODO: Uncomment below once image tags are validated after merging | |
# push: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
push: false | |
tags: ubercadence/server:${{ needs.meta.outputs.image_tag }}-auto-setup | |
- name: Validate tag | |
run: | | |
echo "ubercadence/server:${{ needs.meta.outputs.image_tag }}-auto-setup" | |
push_cli_image: | |
name: Push CLI image to Docker Hub | |
needs: meta | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
if: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
with: | |
username: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64 | |
build-args: TARGET=cli | |
# TODO: Uncomment below once image tags are validated after merging | |
# push: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
push: false | |
tags: ubercadence/cli:${{ needs.meta.outputs.image_tag }} | |
- name: Validate tag | |
run: | | |
echo "ubercadence/cli:${{ needs.meta.outputs.image_tag }}" | |
push_bench_image: | |
name: Push bench image to Docker Hub on master pushes | |
needs: meta | |
runs-on: ubuntu-latest | |
if: ${{ needs.meta.outputs.image_tag == 'master' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
if: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
with: | |
username: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64 | |
build-args: TARGET=bench | |
tags: ubercadence/bench:master | |
push: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
push_canary_image: | |
name: Push canary image to Docker Hub on master pushes | |
needs: meta | |
runs-on: ubuntu-latest | |
if: ${{ needs.meta.outputs.image_tag == 'master' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
if: ${{ needs.meta.outputs.push_enabled == 'true' }} | |
with: | |
username: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64 | |
build-args: TARGET=canary | |
tags: ubercadence/canary:master | |
push: ${{ needs.meta.outputs.push_enabled == 'true' }} |