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 }}"
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-')
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
0 commit comments