Skip to content

Update README.md

Update README.md #249

name: Publish Empiric Package
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: satackey/action-docker-layer-caching@v0.0.11
continue-on-error: true
with:
key: docker-2 # increment to reset cache
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Load cached Poetry installation
uses: actions/cache@v3
with:
path: ~/.local # the path depends on the OS
key: poetry-3 # increment to reset cache
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.0
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Build and publish Python package
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry install --only dev
cd empiric-package
poetry config pypi-token.pypi $PYPI_API_TOKEN
poetry publish --build --skip-existing
- name: Build and publish Docker image
env:
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
run: |
export $(grep -v '^#' .env | xargs)
export EMPIRIC_PACKAGE_VERSION=$(grep 'version' empiric-package/pyproject.toml | grep -e '[0-9][0-9a-zA-Z]*[-.a-z0-9]*' -o)
echo $EMPIRIC_PACKAGE_VERSION
docker build . --target production --build-arg EMPIRIC_PACKAGE_VERSION=${EMPIRIC_PACKAGE_VERSION} -t astralylabs/empiric-publisher:${EMPIRIC_PACKAGE_VERSION}
echo $DOCKER_ACCESS_TOKEN | docker login -u ${DOCKER_LOGIN} --password-stdin
docker push astralylabs/empiric-publisher:${EMPIRIC_PACKAGE_VERSION}