-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.44 KB
/
reusable-cd-dev.yml
File metadata and controls
51 lines (41 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: CD - Dev Publishing
on:
workflow_call:
env:
TEST_PYPI_UPLOAD_URL: "https://test.pypi.org/legacy/"
TEST_PYPI_INSTALL_URL: "https://test.pypi.org/simple/"
jobs:
publish-dev:
runs-on: ubuntu-latest
environment: test-pypi
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Calculate dev version
id: version
shell: bash
run: |
# Get latest tag or default to 0.0.0
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
echo "Latest tag: $LATEST_TAG"
# Remove 'v' prefix if present
LATEST_TAG=${LATEST_TAG#v}
# Parse version components
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_TAG"
# If no tags found, default to 0.0.0
if [ -z "$MAJOR" ]; then
MAJOR=0
MINOR=0
PATCH=0
fi
TIMESTAMP=$(date +%Y%m%d%H%M%S)
DEV_VERSION="${MAJOR}.${MINOR}.${PATCH}.dev${TIMESTAMP}"
echo "Dev version: $DEV_VERSION"
echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT
- name: Build and publish to TestPyPI
uses: ./.github/actions/build-and-publish
with:
pypi-upload-url: ${{ env.TEST_PYPI_UPLOAD_URL }}
pypi-install-url: ${{ env.TEST_PYPI_INSTALL_URL }}
version-override: ${{ steps.version.outputs.version }}
pypi-token: ${{ secrets.TEST_PYPI_API_TOKEN }}