Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 17 additions & 24 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
name: CD Workflow

on:
on:
push:
tags:
- "services/[a-zA-Z]+/v[0-9]+.[0-9]+.[0-9]+*"
- "core/v[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:
branches:
- main

jobs:
main:
name: Build & Publish module
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Extract updated module path
python-version: "3.8"
- name: Push tag for each updated package
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
PACKAGE_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 "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV
- name: Build & Publish to PyPi
GH_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
run: |
git config --global user.name "SDK Releaser Bot"
git config --global user.email "[email protected]"

pip install poetry
cd $PACKAGE_PATH
poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}"
scripts/cd.sh

28 changes: 0 additions & 28 deletions .github/workflows/release-trigger.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/trigger_script.sh → scripts/cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ for file in $(git diff --name-only HEAD~1..HEAD | grep pyproject.toml); do
if git rev-parse --verify $expected_tag^{tag} &> /dev/null; then
echo "Tag '$expected_tag' already exists."
else
# Tag doesn't exist. Create tag and build/publish to PyPi
echo "Tag '$expected_tag' does not exist. Creating new tag to trigger release."
git tag -a $expected_tag -m "Release $version"
git push origin tag $expected_tag
poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}"
fi
done
Loading