Skip to content

Commit 53cdd8f

Browse files
committed
use specified ref
1 parent 18a4c6d commit 53cdd8f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

.github/workflows/docker.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77
inputs:
88
branch-or-tag:
9-
description: "Branch or tag to use for the Docker image tag (optional)"
9+
description: "Branch or tag to use for the Docker image tag and ref to checkout (optional)"
1010
required: false
1111
default: ""
1212

@@ -27,8 +27,19 @@ jobs:
2727
runs-on: SubtensorCI
2828

2929
steps:
30+
- name: Determine Docker tag and ref
31+
id: tag
32+
run: |
33+
# Use the provided branch-or-tag input or fallback to the current ref
34+
branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
35+
echo "Determined branch or tag: $branch_or_tag"
36+
echo "tag=$branch_or_tag" >> $GITHUB_ENV
37+
echo "ref=$branch_or_tag" >> $GITHUB_ENV
38+
3039
- name: Checkout code
3140
uses: actions/checkout@v4
41+
with:
42+
ref: ${{ env.ref }}
3243

3344
- name: Set up QEMU
3445
uses: docker/setup-qemu-action@v2
@@ -43,14 +54,6 @@ jobs:
4354
username: ${{ github.actor }}
4455
password: ${{ secrets.GITHUB_TOKEN }}
4556

46-
- name: Determine Docker tag
47-
id: tag
48-
run: |
49-
# Use the provided branch-or-tag input or fallback to the current ref
50-
branch_or_tag="${{ github.event.inputs.branch-or-tag || github.ref_name }}"
51-
echo "Determined branch or tag: $branch_or_tag"
52-
echo "tag=$branch_or_tag" >> $GITHUB_ENV
53-
5457
- name: Build and push Docker image
5558
uses: docker/build-push-action@v4
5659
with:

0 commit comments

Comments
 (0)