Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
ci(github): add package publish to ghcr (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm authored Mar 27, 2024
1 parent cb43b1e commit f2fc16f
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ on:
push:
branches: main

env:
BACKEND_IMAGE_NAME: contribution-api
DEMO_IMAGE_NAME: gradio
DOCKERHUB_USER: quackai

jobs:
dockerhub:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -21,17 +29,29 @@ jobs:
poetry export -f requirements.txt --without-hashes --only demo --output demo/requirements.txt
- name: Build docker images
run: |
docker build -f src/Dockerfile . -t quackai/contribution-api:latest
docker build -f demo/Dockerfile . -t quackai/gradio:latest
docker build -f src/Dockerfile . -t $DOCKERHUB_USER/$BACKEND_IMAGE_NAME:latest
docker build -f demo/Dockerfile . -t $DOCKERHUB_USER/$DEMO_IMAGE_NAME:latest
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: quackai
username: $DOCKERHUB_USER
password: ${{ secrets.DOCKERHUB_PW }}
- name: Push to hub
run: |
docker push quackai/contribution-api:latest
docker push quackai/gradio:latest
docker push $DOCKERHUB_USER/$BACKEND_IMAGE_NAME:latest
docker push $DOCKERHUB_USER/$DEMO_IMAGE_NAME:latest
- name: Log in to GitHub container registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push to container registry
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$BACKEND_IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag $DOCKERHUB_USER/$BACKEND_IMAGE_NAME:latest $IMAGE_ID:latest
docker push $IMAGE_ID:latest
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$DEMO_IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
docker tag $DOCKERHUB_USER/$DEMO_IMAGE_NAME:latest $IMAGE_ID:latest
docker push $IMAGE_ID:latest
deploy-dev:
needs: dockerhub
Expand Down

0 comments on commit f2fc16f

Please sign in to comment.