Skip to content

Commit

Permalink
Use dynamic repo owner for docker tags
Browse files Browse the repository at this point in the history
**What**
- Calculate the repo owner from the repository owner, so that docker
  images can be pushed to forked GHCR

Signed-off-by: Lucas Roesler <[email protected]>
  • Loading branch information
LucasRoesler committed Feb 12, 2021
1 parent 881aba1 commit e059b42
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Make all
run: make all
- name: Get Repo Owner
id: get_repo_owner
run: >
echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} |
tr '[:upper:]' '[:lower:]')
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand All @@ -38,4 +43,4 @@ jobs:
outputs: "type=image,push=false"
platforms: linux/amd64,linux/arm64,linux/arm/v7
# throw away tag, since we don't push the image
tags: ghcr.io/openfaas/of-watchdog:${{ github.sha }}
tags: ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/of-watchdog:${{ github.sha }}
7 changes: 6 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
- name: Get TAG
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
- name: Get Repo Owner
id: get_repo_owner
run: >
echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} |
tr '[:upper:]' '[:lower:]')
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand All @@ -42,7 +47,7 @@ jobs:
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ghcr.io/openfaas/of-watchdog:${{ steps.get_tag.outputs.TAG }}
tags: ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/of-watchdog:${{ steps.get_tag.outputs.TAG }}
- name: Upload release binaries
uses: alexellis/[email protected]
env:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export GOFLAGS=-mod=vendor
all: gofmt test dist hashgen

.PHONY: test
test: fmt
test:
@echo "+ $@"
@go test -v ./...

Expand Down

0 comments on commit e059b42

Please sign in to comment.