Skip to content

Commit dccec11

Browse files
refactor: Update CI workflows to streamline version bumping and deployment processes. Remove redundant tagging in bump-minor workflow, adjust branch handling in static analysis, and enhance build and deploy conditions for better clarity and efficiency.
1 parent 2f53754 commit dccec11

File tree

4 files changed

+75
-52
lines changed

4 files changed

+75
-52
lines changed

.github/workflows/bump-minor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ jobs:
2727
git config user.email "actions@github.com"
2828
git add pyproject.toml
2929
git commit -m "ci: bump minor version to v${{ env.VERSION }} [skip ci]" || echo "No changes"
30-
git tag v${{ env.VERSION }} || echo "Tag exists"
31-
git push origin HEAD:main --follow-tags
30+
git push origin HEAD:main

.github/workflows/ci-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Static Analysis
22

33
on:
44
push:
5+
branches-ignore:
6+
- main
7+
- 'release/*'
58
pull_request:
69
workflow_dispatch:
710

.github/workflows/ci-build.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
name: Build
22

33
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
- main
48
workflow_run:
59
workflows:
6-
- CI StaticAnalysis
10+
- Static Analysis
711
types:
812
- completed
913

1014
jobs:
1115
build:
1216
if: >-
13-
github.event.workflow_run.conclusion == 'success' &&
14-
(
15-
startsWith(github.event.workflow_run.head_branch, 'main') ||
16-
startsWith(github.event.workflow_run.head_branch, 'develop') ||
17-
startsWith(github.event.workflow_run.head_branch, 'release/')
17+
(github.event_name == 'workflow_run' &&
18+
github.event.workflow_run.conclusion == 'success' &&
19+
(
20+
startsWith(github.event.workflow_run.head_branch, 'main') ||
21+
startsWith(github.event.workflow_run.head_branch, 'develop')
22+
)
23+
) ||
24+
(github.event_name == 'pull_request' &&
25+
(
26+
github.event.pull_request.base.ref == 'main' ||
27+
github.event.pull_request.base.ref == 'develop'
28+
)
1829
)
1930
environment: staging
2031
name: Build FastMCP Docker Image

.github/workflows/ci-deploy.yml

Lines changed: 54 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,87 @@
11
name: Deploy
22

33
on:
4+
push:
5+
branches:
6+
- 'release/*'
47
workflow_run:
58
workflows:
6-
- Build
79
- Bump Minor Version
810
types:
911
- completed
1012

1113
jobs:
12-
deploy_images:
13-
name: Deploy Docker Images
14-
if: >-
15-
github.event.workflow_run.conclusion == 'success' &&
16-
startsWith(github.event.workflow_run.head_branch, 'release/')
17-
runs-on: ubuntu-latest
18-
environment: production
19-
steps:
20-
- uses: actions/checkout@v4
21-
- name: Install uv and dev dependencies
22-
run: |
23-
curl -LsSf https://astral.sh/uv/install.sh | sh
24-
uv sync --only-dev
25-
- name: Extract version
26-
id: extract_version
27-
run: |
28-
echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
29-
- name: Log in to Docker Hub
30-
uses: docker/login-action@v2
31-
with:
32-
username: ${{ secrets.DOCKERHUB_USERNAME }}
33-
password: ${{ secrets.DOCKERHUB_TOKEN }}
34-
- name: Set up Docker Buildx
35-
uses: docker/setup-buildx-action@v3
36-
37-
- name: Build and push FastMCP image
38-
uses: docker/build-push-action@v5
39-
with:
40-
context: .
41-
target: fastmcp
42-
push: true
43-
tags: |
44-
madmathematician971/mcp-it-tools-fastmcp:latest
45-
madmathematician971/mcp-it-tools-fastmcp:${{ env.VERSION }}
46-
4714
create_release:
48-
name: Create Release Tag
15+
name: Create Release and Tag
4916
if: >-
5017
github.event.workflow_run.conclusion == 'success' &&
5118
github.event.workflow_run.head_branch == 'main'
5219
runs-on: ubuntu-latest
5320
environment: production
5421
steps:
5522
- uses: actions/checkout@v4
23+
5624
- name: Install uv and dev dependencies
5725
run: |
5826
curl -LsSf https://astral.sh/uv/install.sh | sh
5927
uv sync --only-dev
28+
6029
- name: Extract version
6130
id: extract_version
6231
run: |
6332
echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
64-
- name: Create and push Git tag
65-
run: |
66-
git config user.name "github-actions"
67-
git config user.email "actions@github.com"
68-
git tag v${{ env.VERSION }}
69-
git push origin v${{ env.VERSION }}
33+
7034
- name: Create GitHub Release
7135
uses: actions/create-release@v1
7236
with:
7337
tag_name: v${{ env.VERSION }}
7438
release_name: v${{ env.VERSION }}
7539
body: "Release v${{ env.VERSION }}"
7640
env:
77-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Create and push release branch
44+
run: |
45+
git config user.name "github-actions"
46+
git config user.email "actions@github.com"
47+
git checkout -b "release/v${{ env.VERSION }}"
48+
git push origin "release/v${{ env.VERSION }}"
49+
50+
deploy_images:
51+
name: Deploy Docker Images
52+
if: >-
53+
github.event_name == 'push' &&
54+
startsWith(github.ref, 'refs/heads/release/')
55+
runs-on: ubuntu-latest
56+
environment: production
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Install uv and dev dependencies
61+
run: |
62+
curl -LsSf https://astral.sh/uv/install.sh | sh
63+
uv sync --only-dev
64+
65+
- name: Extract version
66+
id: extract_version
67+
run: |
68+
echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV
69+
70+
- name: Log in to Docker Hub
71+
uses: docker/login-action@v2
72+
with:
73+
username: ${{ secrets.DOCKERHUB_USERNAME }}
74+
password: ${{ secrets.DOCKERHUB_TOKEN }}
75+
76+
- name: Set up Docker Buildx
77+
uses: docker/setup-buildx-action@v3
78+
79+
- name: Build and push FastMCP image
80+
uses: docker/build-push-action@v5
81+
with:
82+
context: .
83+
target: fastmcp
84+
push: true
85+
tags: |
86+
madmathematician971/mcp-it-tools-fastmcp:latest
87+
madmathematician971/mcp-it-tools-fastmcp:${{ env.VERSION }}

0 commit comments

Comments
 (0)