Skip to content

Commit

Permalink
extract hard-coded names into variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeurer committed Aug 24, 2022
1 parent 8591054 commit 5de92a0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
- development
- docker_workflow

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DOCKERHUB_IMAGE_NAME: mfeurer/auto-sklearn

jobs:

push_to_registry:
Expand Down Expand Up @@ -38,7 +43,7 @@ jobs:
id: meta_dockerhub
uses: docker/metadata-action@v4
with:
images: mfeurer/auto-sklearn
images: ${{ env.DOCKERHUB_IMAGE_NAME }}

- name: Push to Docker Hub
uses: docker/build-push-action@v3
Expand All @@ -51,15 +56,15 @@ jobs:
- name: Login to Github
uses: docker/login-action@v2
with:
registry: ghcr.io
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker on Github Packages
id: meta_githubpackages
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Push to GitHub Packages
uses: docker/build-push-action@v3
Expand All @@ -70,12 +75,12 @@ jobs:
labels: ${{ steps.meta_githubpackages.outputs.labels }}

- name: Pull Docker image from Github Packages
run: docker pull ghcr.io/automl/auto-sklearn:$BRANCH
run: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$BRANCH
env:
BRANCH: ${{ steps.extract_branch.outputs.branch }}

- name: Run image
run: docker run -i -d --name unittester -v $GITHUB_WORKSPACE:/workspace -w /workspace ghcr.io/automl/auto-sklearn:$BRANCH
run: docker run -i -d --name unittester -v $GITHUB_WORKSPACE:/workspace -w /workspace ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$BRANCH
env:
BRANCH: ${{ steps.extract_branch.outputs.branch }}

Expand Down

0 comments on commit 5de92a0

Please sign in to comment.