Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: ${{ runner.os }}-pip-${ hashFiles('**/requirements.txt') }}
- name: Install flake8
run: |
python -m pip install --upgrade pip
Expand All @@ -53,7 +53,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: ${{ runner.os }}-pip-${ hashFiles('**/requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
Expand All @@ -75,47 +75,62 @@ jobs:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Prepare lowercase image names
run: |
echo "IMAGE_NAME=$(echo \"${GITHUB_REPOSITORY}\" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
if [ -n "${DOCKERHUB_USERNAME:-}" ]; then
REPO_NAME="${GITHUB_REPOSITORY##*/}"
echo "DOCKERHUB_IMAGE=$(echo \"${DOCKERHUB_USERNAME}/${REPO_NAME}\" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
fi
shell: bash

- name: Log into GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Optionally log into Docker Hub
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ env.DOCKERHUB_TOKEN }}

- name: Build and push image to GHCR
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.prod
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${ env.IMAGE_NAME }}:latest
ghcr.io/${ env.IMAGE_NAME }}:${ github.sha }}

- name: Optionally push to Docker Hub
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN }}
if: ${{ env.DOCKERHUB_USERNAME && env.DOCKERHUB_TOKEN && env.DOCKERHUB_IMAGE }}
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.prod
push: true
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest
${{ env.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ github.sha }}
${{ env.DOCKERHUB_IMAGE }}:latest
${{ env.DOCKERHUB_IMAGE }}:${ github.sha }}
- name: Create release (optional)
if: github.event_name == 'workflow_dispatch'
uses: ncipollo/release-action@v1
with:
tag: v${{ github.run_number }}
tag: v${ github.run_number }}
name: "Automated release ${{ github.run_number }}"
body: |
Automated release from CI build ${{ github.run_id }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ dist/
*.egg
.DS_Store
.ipynb_checkpoints
/.vscode/
/.idea/

5 changes: 0 additions & 5 deletions gitignore

This file was deleted.

1 change: 0 additions & 1 deletion mykey.pub

This file was deleted.