Skip to content

fix cd pipeline (#39) #2

fix cd pipeline (#39)

fix cd pipeline (#39) #2

Workflow file for this run

name: CD Workflow
on:
push:
tags:
- "services/[a-zA-Z]+/v[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:
jobs:
main:
name: Build & Publish module
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Extract updated module path
env:
TAG: ${{ github.event.ref }}
run: |
# Remove the `refs/tags` prefix of the git tag
TAG_NO_PREFIX=$(echo "$TAG" | sed 's/^refs\/tags\///')
# Extract the path of the module to publish from the tag
SERVICE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev)
# Save the path to the module for use in the build/publish step to only update the module associated with this tag
echo "SERVICE_PATH=$SERVICE_PATH" >> $GITHUB_ENV
- name: Build & Publish to PyPi
run: |
pip install poetry
cd $SERVICE_PATH
poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}"