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

ci(github): add package publish to ghcr (#135) #86

ci(github): add package publish to ghcr (#135)

ci(github): add package publish to ghcr (#135) #86

Workflow file for this run

name: push
on:
push:
branches: main
env:
BACKEND_IMAGE_NAME: contribution-api
DEMO_IMAGE_NAME: gradio
DOCKERHUB_USER: quackai
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
- uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.7.1"
- name: Resolve dependencies
run: |
poetry export -f requirements.txt --without-hashes --output requirements.txt
poetry export -f requirements.txt --without-hashes --only demo --output demo/requirements.txt
- name: Build docker images
run: |
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: $DOCKERHUB_USER
password: ${{ secrets.DOCKERHUB_PW }}
- name: Push to hub
run: |
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

Check failure on line 57 in .github/workflows/push.yml

View workflow run for this annotation

GitHub Actions / push

Invalid workflow file

The workflow is not valid. .github/workflows/push.yml (Line: 57, Col: 12): Job 'deploy-dev' depends on unknown job 'dockerhub'.
runs-on: ubuntu-latest
steps:
- uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_DEV_HOST }}
username: ${{ secrets.SSH_DEV_USERNAME }}
key: ${{ secrets.SSH_DEPLOY_DEV }}
script: |
docker pull quackai/contribution-api:latest
docker rmi -f $(docker images -f "dangling=true" -q)
cd devops && docker compose stop backend && docker compose up -d && docker compose exec backend alembic upgrade head
docker inspect -f '{{ .Created }}' $(docker compose images -q backend)
- name: Ping server
env:
DEV_ENDPOINT: ${{ secrets.DEV_ENDPOINT }}
run: sleep 10 && curl $DEV_ENDPOINT