Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker workflow #1576

Merged
merged 10 commits into from
Aug 30, 2022
63 changes: 44 additions & 19 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 All @@ -23,39 +28,59 @@ jobs:

- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
run: |
echo "Working on GITHUB_REF ${GITHUB_REF}"
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Push to GitHub Packages
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Extract metadata (tags, labels) for Docker Hub
id: meta_dockerhub
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKERHUB_IMAGE_NAME }}

- name: Push to Docker Hub
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta_dockerhub.outputs.tags }}
labels: ${{ steps.meta_dockerhub.outputs.labels }}

- name: Login to Github
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: automl/auto-sklearn/auto-sklearn
tag_with_ref: true
tags: ${{ steps.extract_branch.outputs.branch }}

- name: Push to Docker Hub
uses: docker/build-push-action@v3
- name: Extract metadata (tags, labels) for Docker on Github Packages
id: meta_githubpackages
uses: docker/metadata-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
repository: mfeurer/auto-sklearn
tags: ${{ steps.extract_branch.outputs.branch }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Docker Login
run: docker login docker.pkg.github.com -u $GITHUB_ACTOR -p $GITHUB_TOKEN
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Push to GitHub Packages
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta_githubpackages.outputs.tags }}
labels: ${{ steps.meta_githubpackages.outputs.labels }}

- name: Pull Docker image
run: docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/auto-sklearn:$BRANCH
- name: Pull Docker image from Github Packages
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 docker.pkg.github.com/$GITHUB_REPOSITORY/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