|
1 | 1 | name: Deploy |
2 | 2 |
|
3 | 3 | on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'release/*' |
4 | 7 | workflow_run: |
5 | 8 | workflows: |
6 | | - - Build |
7 | 9 | - Bump Minor Version |
8 | 10 | types: |
9 | 11 | - completed |
10 | 12 |
|
11 | 13 | 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 | | -
|
47 | 14 | create_release: |
48 | | - name: Create Release Tag |
| 15 | + name: Create Release and Tag |
49 | 16 | if: >- |
50 | 17 | github.event.workflow_run.conclusion == 'success' && |
51 | 18 | github.event.workflow_run.head_branch == 'main' |
52 | 19 | runs-on: ubuntu-latest |
53 | 20 | environment: production |
54 | 21 | steps: |
55 | 22 | - uses: actions/checkout@v4 |
| 23 | + |
56 | 24 | - name: Install uv and dev dependencies |
57 | 25 | run: | |
58 | 26 | curl -LsSf https://astral.sh/uv/install.sh | sh |
59 | 27 | uv sync --only-dev |
| 28 | +
|
60 | 29 | - name: Extract version |
61 | 30 | id: extract_version |
62 | 31 | run: | |
63 | 32 | 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 | +
|
70 | 34 | - name: Create GitHub Release |
71 | 35 | uses: actions/create-release@v1 |
72 | 36 | with: |
73 | 37 | tag_name: v${{ env.VERSION }} |
74 | 38 | release_name: v${{ env.VERSION }} |
75 | 39 | body: "Release v${{ env.VERSION }}" |
76 | 40 | 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