This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, Push Docker Image, and Deploy Python Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Create remote builder certificates | |
run: | | |
echo "${{ secrets.BUILDKIT_CA_PEM }}" > ${{ github.workspace }}/client-ca.pem | |
echo "${{ secrets.BUILDKIT_CERT_PEM }}" > ${{ github.workspace }}/client-cert.pem | |
echo "${{ secrets.BUILDKIT_KEY_PEM }}" > ${{ github.workspace }}/client-key.pem | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: remote | |
endpoint: "tcp://buildkit.herodotus.dev:5000" | |
driver-opts: | | |
cacert=${{ github.workspace }}/client-ca.pem | |
cert=${{ github.workspace }}/client-cert.pem | |
key=${{ github.workspace }}/client-key.pem | |
cleanup: true | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
file: environment.dockerfile | |
tags: "dataprocessor/hdp-cairo:latest" | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build Python package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Upload Python package to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
twine upload dist/* |