Skip to content

Build and Release

Build and Release #12

Workflow file for this run

name: Release
on:
workflow_dispatch:
workflow_run:
workflows: ["Build"]
types:
- completed
env:
DOCKER_IMAGE_NAME: capitec-decision-engine
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12.4"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry versioneer setuptools
- name: Get version
run: |
version=$(python setup.py --version)
echo "PACKAGE_VERSION=$(python setup.py --version)" >> $GITHUB_ENV
- name: Download Python Artifact
uses: actions/download-artifact@v3
with:
name: python
path: dist/py
- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
load: true
tags: ${{ env.DOCKER_IMAGE_NAME }}:hold
file: docker/Dockerfile
- name: Upload Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ env.PACKAGE_VERSION }}
file: docker/Dockerfile
# - name: Upload Latest Docker image
# uses: docker/build-push-action@v3
# if: github.ref == 'refs/heads/main'
# with:
# push: true
# tags: ${{ env.DOCKER_IMAGE_NAME }}:latest
# - name: Publish python package
# env:
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# run: |
# twine upload dist/py/*
- name: Deploy documentation to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v4
- name: Tag Release
run: |
git tag -a v${{ env.PACKAGE_VERSION }} -m "Release v${{ env.PACKAGE_VERSION }}"
git push origin v${{ env.PACKAGE_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}