Skip to content

Commit 3cd0ed1

Browse files
authored
Merge pull request #18 from joagonzalez/rc-v0.1.0
Rc v0.1.0
2 parents 01f2a4e + 448c1b8 commit 3cd0ed1

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

.github/workflows/pipeline.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
branches:
77
- '**'
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
build:
1114
runs-on: ubuntu-latest
@@ -35,6 +38,16 @@ jobs:
3538
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
3639
echo "version=$VERSION" >> $GITHUB_OUTPUT
3740
41+
- name: Set VERSION file (rc-* only)
42+
if: startsWith(github.ref_name, 'rc-')
43+
run: |
44+
echo "${{ steps.gitinfo.outputs.version }}" > VERSION
45+
git config user.name "GitHub Actions"
46+
git config user.email "[email protected]"
47+
git add VERSION
48+
git commit -m "ci: set VERSION file" || echo "No changes to commit"
49+
git push
50+
3851
- name: Notify Telegram - pre build
3952
run: |
4053
BRANCH="${{ steps.gitinfo.outputs.branch }}"
@@ -82,9 +95,9 @@ jobs:
8295
- name: Build and push Docker image (rc-* only)
8396
if: startsWith(github.ref_name, 'rc-')
8497
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 }}
98+
VERSION=$(cat VERSION)
99+
docker build -t joagonzalez/python-seed-api:$VERSION -f build/calculator/Dockerfile .
100+
docker push joagonzalez/python-seed-api:$VERSION
88101
89102
- name: Deploy to VPS (rc-* only)
90103
if: startsWith(github.ref_name, 'rc-')
@@ -94,7 +107,7 @@ jobs:
94107
echo "$KUBECONFIG_B64" | base64 -d > kubeconfig.yaml
95108
export KUBECONFIG=$PWD/kubeconfig.yaml
96109
97-
export IMAGE_TAG=${{ steps.gitinfo.outputs.version }}
110+
export IMAGE_TAG=$(cat VERSION)
98111
kubectl version --client
99112
kubectl config get-contexts
100113
echo "Deploying version $IMAGE_TAG"
@@ -108,31 +121,22 @@ jobs:
108121
make coverage-publish
109122
110123
- name: Create GitHub Release (master only)
111-
if: github.ref_name == 'master' && github.event.pull_request.head.ref != ''
124+
if: github.ref_name == 'master'
112125
env:
113126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114127
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"
128+
FULL_VERSION=$(cat VERSION)
129+
VERSION=$(echo "$FULL_VERSION" | cut -d '-' -f1)
130+
echo "🚀 Creating release: $VERSION"
125131
126132
git config user.name "GitHub Actions"
127133
git config user.email "[email protected]"
128134
129135
git tag "$VERSION"
130136
git push origin "$VERSION"
131137
132-
echo "🔍 Generating changelog from commits..."
133138
CHANGELOG=$(git log --pretty=format:"- %s (%an)" $(git describe --tags --abbrev=0)..HEAD)
134139
135-
echo "📦 Creating GitHub release..."
136140
gh release delete "$VERSION" -y || true
137141
gh release create "$VERSION" --title "$VERSION" --notes "$CHANGELOG"
138142

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)

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.1.0-d84f7ab-24

0 commit comments

Comments
 (0)