Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make docker image builds trigger on key branches + ability to manually trigger #1168

Merged
merged 5 commits into from
Jan 21, 2025
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
branch-or-tag:
description: "Branch or tag to use for the Docker image tag and ref to checkout (optional)"
required: false
default: ""

push:
branches:
- devnet-ready
- devnet
- testnet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not testing on main?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, for main people should use the releases, which also get deployed by this automatically


permissions:
contents: read
Expand All @@ -16,8 +27,18 @@ jobs:
runs-on: SubtensorCI

steps:
- name: Determine Docker tag and ref
id: tag
run: |
branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
echo "Determined branch or tag: $branch_or_tag"
echo "tag=$branch_or_tag" >> $GITHUB_ENV
echo "ref=$branch_or_tag" >> $GITHUB_ENV

- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.ref }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -32,18 +53,10 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ steps.meta.outputs.tags }}
ghcr.io/${{ github.repository }}:latest
labels: ${{ steps.meta.outputs.labels }}
ghcr.io/${{ github.repository }}:${{ env.tag }}
Loading