Skip to content

Commit fb34e0c

Browse files
authored
Merge pull request #16 from joagonzalez/feature/seed
update coverage badge and pipeline with new tagging strategy and release
2 parents bc30b80 + e264da5 commit fb34e0c

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

.github/workflows/pipeline.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ jobs:
3535
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
3636
echo "version=$VERSION" >> $GITHUB_OUTPUT
3737
38+
- name: Set VERSION file (rc-* only)
39+
if: startsWith(github.ref_name, 'rc-')
40+
run: |
41+
echo "${{ steps.gitinfo.outputs.version }}" > VERSION
42+
git config user.name "GitHub Actions"
43+
git config user.email "[email protected]"
44+
git add VERSION
45+
git commit -m "ci: set VERSION file" || echo "No changes to commit"
46+
git push
47+
3848
- name: Notify Telegram - pre build
3949
run: |
4050
BRANCH="${{ steps.gitinfo.outputs.branch }}"
@@ -82,9 +92,9 @@ jobs:
8292
- name: Build and push Docker image (rc-* only)
8393
if: startsWith(github.ref_name, 'rc-')
8494
run: |
85-
docker build -t joagonzalez/python-seed-api:${{ steps.gitinfo.outputs.version }} -f build/calculator/Dockerfile .
86-
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USER }}" --password-stdin
87-
docker push joagonzalez/python-seed-api:${{ steps.gitinfo.outputs.version }}
95+
VERSION=$(cat VERSION)
96+
docker build -t joagonzalez/python-seed-api:$VERSION -f build/calculator/Dockerfile .
97+
docker push joagonzalez/python-seed-api:$VERSION
8898
8999
- name: Deploy to VPS (rc-* only)
90100
if: startsWith(github.ref_name, 'rc-')
@@ -94,7 +104,7 @@ jobs:
94104
echo "$KUBECONFIG_B64" | base64 -d > kubeconfig.yaml
95105
export KUBECONFIG=$PWD/kubeconfig.yaml
96106
97-
export IMAGE_TAG=${{ steps.gitinfo.outputs.version }}
107+
export IMAGE_TAG=$(cat VERSION)
98108
kubectl version --client
99109
kubectl config get-contexts
100110
echo "Deploying version $IMAGE_TAG"
@@ -108,31 +118,22 @@ jobs:
108118
make coverage-publish
109119
110120
- name: Create GitHub Release (master only)
111-
if: github.ref_name == 'master' && github.event.pull_request.head.ref != ''
121+
if: github.ref_name == 'master'
112122
env:
113123
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114124
run: |
115-
RC_BRANCH="${{ github.event.pull_request.head.ref }}"
116-
echo "RC branch: $RC_BRANCH"
117-
118-
VERSION=$(echo "$RC_BRANCH" | grep -o "v[0-9]\+\.[0-9]\+\.[0-9]\+")
119-
if [[ -z "$VERSION" ]]; then
120-
echo "❌ No version tag found in branch name. Expected rc-vX.Y.Z"
121-
exit 0
122-
fi
123-
124-
echo "✅ Version to release: $VERSION"
125+
FULL_VERSION=$(cat VERSION)
126+
VERSION=$(echo "$FULL_VERSION" | cut -d '-' -f1)
127+
echo "🚀 Creating release: $VERSION"
125128
126129
git config user.name "GitHub Actions"
127130
git config user.email "[email protected]"
128131
129132
git tag "$VERSION"
130133
git push origin "$VERSION"
131134
132-
echo "🔍 Generating changelog from commits..."
133135
CHANGELOG=$(git log --pretty=format:"- %s (%an)" $(git describe --tags --abbrev=0)..HEAD)
134136
135-
echo "📦 Creating GitHub release..."
136137
gh release delete "$VERSION" -y || true
137138
gh release create "$VERSION" --title "$VERSION" --notes "$CHANGELOG"
138139

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
![Python](https://img.shields.io/badge/platform-linux-blue)
44
[![Build Status](https://github.com/joagonzalez/python-seed-v2/actions/workflows/pipeline.yml/badge.svg)](https://github.com/joagonzalez/python-seed-v2/actions/workflows/pipeline.yml)
55
[![Documentation](https://readthedocs.org/projects/python-seed/badge/?)](https://python-seed.readthedocs.io/en/latest/)
6-
[![Coverage Status](https://coveralls.io/repos/github/joagonzalez/python-seed-v2/badge.svg?branch=feature/github-actions)](https://coveralls.io/github/joagonzalez/python-seed-v2?branch=feature/github-actions)
6+
[![Coverage Status](https://coveralls.io/repos/github/joagonzalez/python-seed-v2/badge.svg?branch=master)](https://coveralls.io/github/joagonzalez/python-seed-v2?branch=master)
7+
78
---
89
**Content**
910
- [Getting started](#getting-started)

0 commit comments

Comments
 (0)