Publish Docker Image #464
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: Publish Docker Image | |
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 | |
permissions: | |
contents: read | |
packages: write | |
actions: read | |
security-events: write | |
jobs: | |
publish: | |
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 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository }}:${{ env.tag }} |