PyPi deployment #41
Workflow file for this run
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: PyPi deployment | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
publish: | |
name: Publish pylone | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: getsentry/action-setup-venv@v2.1.0 | |
id: venv | |
with: | |
python-version: 3.12 | |
cache-dependency-path: | | |
requirements.txt | |
requirements-dev.txt | |
install-cmd: pip install -r requirements.txt -r requirements-dev.txt | |
- name: Building pylone | |
run: python3 setup.py sdist bdist_wheel | |
- name: Publishing | |
run: "python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/* -u 'mathix420' -p '${{ secrets.PYPI_PASSWORD }}'" | |
deploy_docker: | |
name: Deploy docker | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set Image URI | |
id: image-uri | |
run: | | |
current_version=$(cat setup.py | grep version | awk -F "'" '{print $2}') | |
echo "::set-output name=tag1::${{ secrets.DOCKERHUB_USERNAME }}/pylone:latest" | |
echo "::set-output name=tag2::${{ secrets.DOCKERHUB_USERNAME }}/pylone:$current_version" | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
id: build-image | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.image-uri.outputs.tag1 }}, ${{ steps.image-uri.outputs.tag2 }} |