Skip to content

Commit b0f34cb

Browse files
committed
Tag and push with branch name
1 parent aed76a8 commit b0f34cb

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/dogfood.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- main
77
paths:
8+
- "flake.nix"
9+
- "flake.lock"
810
- "dogfood/**"
911
- ".github/workflows/dogfood.yaml"
1012
# Uncomment these lines when testing with CI.
@@ -23,6 +25,14 @@ jobs:
2325
- name: Checkout
2426
uses: actions/checkout@v3
2527

28+
- name: "Branch name to Docker tag name"
29+
id: docker-tag-name
30+
run: |
31+
tag=${{ steps.branch-name.outputs.current_branch }}
32+
# Replace / with --, e.g. user/feature => user--feature.
33+
tag=${tag//\//--}
34+
echo "tag=${tag}" >> $GITHUB_OUTPUT
35+
2636
- uses: cachix/install-nix-action@v22
2737
with:
2838
github_access_token: ${{ secrets.GITHUB_TOKEN }}
@@ -36,7 +46,9 @@ jobs:
3646
username: ${{ secrets.DOCKERHUB_USERNAME }}
3747
password: ${{ secrets.DOCKERHUB_PASSWORD }}
3848

39-
- run: docker push codercom/oss-dogfood:testing
49+
- run: |
50+
docker tag codercom/oss-dogfood:latest codercom/oss-dogfood:${{ steps.docker-tag-name.outputs.tag }}
51+
docker push codercom/oss-dogfood -a
4052
4153
deploy_template:
4254
needs: deploy_image

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
# This will import the image into your local Docker daemon.
116116
devEnvImage = pkgs.dockerTools.streamLayeredImage {
117117
name = "codercom/oss-dogfood";
118-
tag = "testing";
118+
tag = "latest";
119119
fromImage = intermediateDevEnvImage;
120120
maxLayers = 64;
121121
contents = [

0 commit comments

Comments
 (0)