Skip to content

Commit 07bc253

Browse files
committed
Updating CI/CD workflows for version release
Signed-off-by: S3B4SZ17 <[email protected]>
1 parent afd5fec commit 07bc253

File tree

2 files changed

+35
-32
lines changed

2 files changed

+35
-32
lines changed

.github/workflows/publish.yaml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
push_to_registry:
2121
name: Push Docker image to GitHub Packages
2222
runs-on: ubuntu-latest
23+
needs: tests
2324
permissions:
2425
contents: read # required for actions/checkout
2526
packages: write # required for pushing to ghcr.io
@@ -77,27 +78,20 @@ jobs:
7778
- name: Check out the repo
7879
uses: actions/checkout@v4
7980

80-
- name: Semantic Release
81-
uses: cycjimmy/semantic-release-action@v4
81+
- name: Get tag version
8282
id: semantic_release
83-
with:
84-
dry_run: true
85-
branches: |
86-
[
87-
'+([0-9])?(.{+([0-9]),x}).x',
88-
'main',
89-
{
90-
name: 'beta',
91-
prerelease: true
92-
},
93-
{
94-
name: 'alpha',
95-
prerelease: true
96-
}
97-
]
83+
uses: anothrNick/[email protected]
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
DEFAULT_BUMP: "patch"
87+
TAG_CONTEXT: ${{ (github.base_ref != 'main') && 'branch' || 'repo' }}
88+
PRERELEASE_SUFFIX: "beta"
89+
PRERELEASE: ${{ (github.base_ref != 'main') && 'true' || 'false' }}
90+
DRY_RUN: false
91+
INITIAL_VERSION: ${{ needs.push_to_registry.outputs.tag }}
9892

9993
- name: Summary
10094
run: |
10195
echo "## Release Summary
102-
- Tag: ${{ steps.semantic_release.outputs.new_release_version }}
103-
- Docker Image: ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY
96+
- Tag: ${{ steps.semantic_release.outputs.tag }}
97+
- Docker Image: ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ needs.push_to_registry.outputs.version }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/test.yaml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
pull_request:
8-
workflow_dispatch:
8+
workflow_call:
99

1010
jobs:
1111
test:
@@ -45,33 +45,42 @@ jobs:
4545
steps:
4646
- name: Check out the repo
4747
uses: actions/checkout@v4
48+
with:
49+
ref: ${{ github.head_ref }} # checkout the correct branch name
50+
fetch-depth: 0
4851

4952
- name: Extract current version
5053
id: pyproject_version
5154
run: |
5255
TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')
5356
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
5457
55-
- name: Semantic Release
56-
uses: cycjimmy/semantic-release-action@v4
58+
- name: Get tag version
5759
id: semantic_release
58-
with:
59-
ci: false
60-
dry_run: true
61-
60+
uses: anothrNick/[email protected]
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
DEFAULT_BUMP: "patch"
64+
TAG_CONTEXT: ${{ (github.base_ref != 'main') && 'branch' || 'repo' }}
65+
PRERELEASE_SUFFIX: "beta"
66+
PRERELEASE: ${{ (github.base_ref != 'main') && 'true' || 'false' }}
67+
DRY_RUN: true
68+
INITIAL_VERSION: ${{ steps.pyproject_version.outputs.TAG }}
69+
6270
- name: Compare versions
6371
run: |
6472
echo "Current version: ${{ steps.pyproject_version.outputs.TAG }}"
65-
echo "New version: ${{ steps.semantic_release.outputs.new_release_version }}"
66-
if [ "${{ steps.pyproject_version.outputs.TAG }}" != "${{ steps.semantic_release.outputs.new_release_version }}" ]; then
73+
echo "New version: ${{ steps.semantic_release.outputs.tag }}"
74+
if [ "${{ steps.pyproject_version.outputs.TAG }}" != "${{ steps.semantic_release.outputs.tag }}" ]; then
6775
echo "### Version mismatch detected! :warning:
68-
Current version: ${{ steps.pyproject_version.outputs.TAG }}
69-
New version: **${{ steps.semantic_release.outputs.new_release_version }}**
76+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
77+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
78+
Current Tag: ${{ steps.semantic_release.outputs.old_tag }}
7079
Please update the version in pyproject.toml." >> $GITHUB_STEP_SUMMARY
7180
exit 1
7281
else
7382
echo "### Version match confirmed! :rocket:
74-
Current version: ${{ steps.pyproject_version.outputs.TAG }}
75-
New version: **${{ steps.semantic_release.outputs.new_release_version }}**
83+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
84+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
7685
The version is up-to-date." >> $GITHUB_STEP_SUMMARY
7786
fi

0 commit comments

Comments
 (0)