66 branches :
77 - ' **'
88
9+ permissions :
10+ contents : write
11+
912jobs :
1013 build :
1114 runs-on : ubuntu-latest
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 }}"
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-')
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
0 commit comments