Skip to content

Commit

Permalink
ci: fix issue where repo name is masked and can't be used as output
Browse files Browse the repository at this point in the history
  • Loading branch information
adamblake committed Jan 3, 2024
1 parent 309c54f commit ebb9645
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
45 changes: 27 additions & 18 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
runs-on: ${{ inputs.runs-on }}

outputs:
image: ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}
image: ${{ inputs.image }}
digest: ${{ steps.build.outputs.digest }}
tags: ${{ steps.meta.outputs.tags }}

Expand Down Expand Up @@ -88,6 +88,32 @@ jobs:
# network=host driver-opt needed to push to local registry
driver-opts: network=host

# https://github.com/docker/login-action
- name: Login to GitHub Container Registry
if: ${{ inputs.publish == 'true' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/docker/login-action
- name: Login to Docker Registry
if: ${{ inputs.publish == 'true' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Pull latest for linux/amd64
shell: bash
run: |
docker pull --platform=linux/amd64 \
ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}:latest
docker tag \
ghcr.io/${{ github.repository_owner }}/${{ inputs.image }}:latest \
localhost:5000/${{ github.repository_owner }}/${{ inputs.image }}:amd64
# https://github.com/docker/build-push-action
- name: Build for linux/amd64
id: build-amd64
Expand Down Expand Up @@ -128,23 +154,6 @@ jobs:
localhost:5000/${{ github.repository_owner }}/${{ inputs.image }}:arm64 \
bash /tmp/test.sh
# https://github.com/docker/login-action
- name: Login to GitHub Container Registry
if: ${{ inputs.publish == 'true' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/docker/login-action
- name: Login to Docker Registry
if: ${{ inputs.publish == 'true' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

# https://github.com/docker/metadata-action
- name: Image Metadata
id: meta
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
type=raw,value=python-3.11
type=raw,value=r-4.3
build-args: |
BASE_IMAGE=${{ needs.base-r.outputs.image }}@${{ needs.base-r.outputs.digest}}
PARENT_IMAGE=${{ needs.base-r.outputs.image }}
BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ needs.base-r.outputs.image }}@${{ needs.base-r.outputs.digest}}
PARENT_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ needs.base-r.outputs.image }}@${{ needs.base-r.outputs.digest}}
publish: true

r:
Expand All @@ -67,8 +67,8 @@ jobs:
type=raw,value=python-3.11
type=raw,value=r-4.3
build-args: |
BASE_IMAGE=${{ needs.base-r.outputs.image }}@${{ needs.base-r.outputs.digest}}
PARENT_IMAGE=${{ needs.essentials.outputs.image }}@${{ needs.essentials.outputs.digest}}
BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ needs.base-r.outputs.image }}@${{ needs.base-r.outputs.digest}}
PARENT_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ needs.essentials.outputs.image }}@${{ needs.essentials.outputs.digest}}
publish: true

datascience:
Expand All @@ -84,6 +84,6 @@ jobs:
type=raw,value=python-3.11
type=raw,value=r-4.3
build-args: |
BASE_IMAGE=${{ needs.base-r.outputs.image }}@${{ needs.base-r.outputs.digest}}
PARENT_IMAGE=${{ needs.r.outputs.image }}@${{ needs.r.outputs.digest}}
BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ needs.base-r.outputs.image }}@${{ needs.base-r.outputs.digest}}
PARENT_IMAGE=ghcr.io/${{ github.repository_owner }}/${{ needs.r.outputs.image }}@${{ needs.r.outputs.digest}}
publish: true

0 comments on commit ebb9645

Please sign in to comment.