Skip to content

Commit 8b9f672

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

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@ on:
44
push:
55
branches:
66
- main
7+
- feat/*
78
paths:
89
- pyproject.toml
910
workflow_dispatch:
1011

1112

1213
jobs:
14+
1315
push_to_registry:
1416
name: Push Docker image to GitHub Packages
1517
runs-on: ubuntu-latest
1618
permissions:
1719
contents: read # required for actions/checkout
1820
packages: write # required for pushing to ghcr.io
1921
id-token: write # required for signing with cosign
22+
outputs:
23+
version: ${{ steps.extract_version.outputs.VERSION }}
24+
tag: ${{ steps.extract_version.outputs.TAG }}
2025
steps:
2126
- name: Check out the repo
2227
uses: actions/checkout@v4
@@ -26,6 +31,8 @@ jobs:
2631
run: |
2732
VERSION=$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')-$(echo $GITHUB_SHA | cut -c1-7)
2833
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
34+
TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')
35+
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
2936
3037
- name: Log in to GitHub Container Registry
3138
uses: docker/login-action@v3
@@ -56,3 +63,36 @@ jobs:
5663
ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }}
5764
DIGEST: ${{ steps.build-and-push.outputs.digest }}
5865
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
66+
67+
tag_release:
68+
name: Tag Release
69+
runs-on: ubuntu-latest
70+
needs: push_to_registry
71+
steps:
72+
- name: Check out the repo
73+
uses: actions/checkout@v4
74+
75+
- name: Semantic Release
76+
uses: cycjimmy/semantic-release-action@v4
77+
id: semantic_release
78+
with:
79+
dry_run: true
80+
branches: |
81+
[
82+
'+([0-9])?(.{+([0-9]),x}).x',
83+
'main',
84+
{
85+
name: 'beta',
86+
prerelease: true
87+
},
88+
{
89+
name: 'alpha',
90+
prerelease: true
91+
}
92+
]
93+
94+
- name: Summary
95+
run: |
96+
echo "## Release Summary
97+
- Tag: ${{ steps.semantic_release.outputs.new_release_version }}
98+
- Docker Image: ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/test.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- main
77
pull_request:
8+
workflow_dispatch:
89

910
jobs:
1011
test:
@@ -34,3 +35,43 @@ jobs:
3435

3536
- name: Run Unit Tests
3637
run: make test
38+
39+
pre_release:
40+
name: Tag Release
41+
runs-on: ubuntu-latest
42+
needs: test
43+
permissions:
44+
contents: write # required for creating a tag
45+
steps:
46+
- name: Check out the repo
47+
uses: actions/checkout@v4
48+
49+
- name: Extract current version
50+
id: pyproject_version
51+
run: |
52+
TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')
53+
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
54+
55+
- name: Semantic Release
56+
uses: cycjimmy/semantic-release-action@v4
57+
id: semantic_release
58+
with:
59+
ci: false
60+
dry_run: true
61+
62+
- name: Compare versions
63+
run: |
64+
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
67+
echo "### Version mismatch detected! :warning:
68+
Current version: ${{ steps.pyproject_version.outputs.TAG }}
69+
New version: **${{ steps.semantic_release.outputs.new_release_version }}**
70+
Please update the version in pyproject.toml." >> $GITHUB_STEP_SUMMARY
71+
exit 1
72+
else
73+
echo "### Version match confirmed! :rocket:
74+
Current version: ${{ steps.pyproject_version.outputs.TAG }}
75+
New version: **${{ steps.semantic_release.outputs.new_release_version }}**
76+
The version is up-to-date." >> $GITHUB_STEP_SUMMARY
77+
fi

0 commit comments

Comments
 (0)