Skip to content

Commit 024ade0

Browse files
committed
Updating CI/CD workflows for version release
Signed-off-by: S3B4SZ17 <sebastian.zumbado@sysdig.com>
1 parent e789d6e commit 024ade0

File tree

4 files changed

+113
-4
lines changed

4 files changed

+113
-4
lines changed

.github/workflows/publish.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,33 @@ on:
66
- main
77
paths:
88
- pyproject.toml
9+
- Dockerfile
10+
- *.py
11+
- tests/**
12+
- tools/**
13+
- utils/**
914
workflow_dispatch:
1015

1116

1217
jobs:
18+
tests:
19+
permissions:
20+
checks: write
21+
pull-requests: write
22+
contents: write
23+
uses: ./.github/workflows/test.yaml
24+
secrets: inherit
1325
push_to_registry:
1426
name: Push Docker image to GitHub Packages
1527
runs-on: ubuntu-latest
28+
needs: tests
1629
permissions:
1730
contents: read # required for actions/checkout
1831
packages: write # required for pushing to ghcr.io
1932
id-token: write # required for signing with cosign
33+
outputs:
34+
version: ${{ steps.extract_version.outputs.VERSION }}
35+
tag: ${{ steps.extract_version.outputs.TAG }}
2036
steps:
2137
- name: Check out the repo
2238
uses: actions/checkout@v4
@@ -26,6 +42,8 @@ jobs:
2642
run: |
2743
VERSION=$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')-$(echo $GITHUB_SHA | cut -c1-7)
2844
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
45+
TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')
46+
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
2947
3048
- name: Log in to GitHub Container Registry
3149
uses: docker/login-action@v3
@@ -56,3 +74,29 @@ jobs:
5674
ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }}
5775
DIGEST: ${{ steps.build-and-push.outputs.digest }}
5876
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
77+
78+
tag_release:
79+
name: Tag Release
80+
runs-on: ubuntu-latest
81+
needs: push_to_registry
82+
steps:
83+
- name: Check out the repo
84+
uses: actions/checkout@v4
85+
86+
- name: Get tag version
87+
id: semantic_release
88+
uses: anothrNick/github-tag-action@1.73.0
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
DEFAULT_BUMP: "patch"
92+
TAG_CONTEXT: ${{ (github.base_ref != 'main') && 'branch' || 'repo' }}
93+
PRERELEASE_SUFFIX: "beta"
94+
PRERELEASE: ${{ (github.base_ref != 'main') && 'true' || 'false' }}
95+
DRY_RUN: false
96+
INITIAL_VERSION: ${{ needs.push_to_registry.outputs.tag }}
97+
98+
- name: Summary
99+
run: |
100+
echo "## Release Summary
101+
- Tag: ${{ steps.semantic_release.outputs.tag }}
102+
- Docker Image: ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ needs.push_to_registry.outputs.version }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/test.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,26 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
8+
- feature/**
9+
- release/**
10+
- hotfix/**
11+
paths:
12+
- pyproject.toml
13+
- Dockerfile
14+
- *.py
15+
- tests/**
16+
- tools/**
17+
- utils/**
718
pull_request:
19+
paths:
20+
- pyproject.toml
21+
- Dockerfile
22+
- *.py
23+
- tests/**
24+
- tools/**
25+
- utils/**
26+
workflow_call:
827

928
jobs:
1029
test:
@@ -34,3 +53,52 @@ jobs:
3453

3554
- name: Run Unit Tests
3655
run: make test
56+
57+
pre_release:
58+
name: Tag Release
59+
runs-on: ubuntu-latest
60+
needs: test
61+
permissions:
62+
contents: write # required for creating a tag
63+
steps:
64+
- name: Check out the repo
65+
uses: actions/checkout@v4
66+
with:
67+
ref: ${{ github.head_ref }} # checkout the correct branch name
68+
fetch-depth: 0
69+
70+
- name: Extract current version
71+
id: pyproject_version
72+
run: |
73+
TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')
74+
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
75+
76+
- name: Get tag version
77+
id: semantic_release
78+
uses: anothrNick/github-tag-action@1.73.0
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
DEFAULT_BUMP: "patch"
82+
TAG_CONTEXT: ${{ (github.base_ref != 'main') && 'branch' || 'repo' }}
83+
PRERELEASE_SUFFIX: "beta"
84+
PRERELEASE: ${{ (github.base_ref != 'main') && 'true' || 'false' }}
85+
DRY_RUN: true
86+
INITIAL_VERSION: ${{ steps.pyproject_version.outputs.TAG }}
87+
88+
- name: Compare versions
89+
run: |
90+
echo "Current version: ${{ steps.pyproject_version.outputs.TAG }}"
91+
echo "New version: ${{ steps.semantic_release.outputs.tag }}"
92+
if [ "${{ steps.pyproject_version.outputs.TAG }}" != "${{ steps.semantic_release.outputs.tag }}" ]; then
93+
echo "### Version mismatch detected! :warning:
94+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
95+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
96+
Current Tag: ${{ steps.semantic_release.outputs.old_tag }}
97+
Please update the version in pyproject.toml." >> $GITHUB_STEP_SUMMARY
98+
exit 1
99+
else
100+
echo "### Version match confirmed! :rocket:
101+
Current pyproject version: ${{ steps.pyproject_version.outputs.TAG }}
102+
New Tag version: **${{ steps.semantic_release.outputs.tag }}**
103+
The version is up-to-date." >> $GITHUB_STEP_SUMMARY
104+
fi

charts/sysdig-mcp/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ image:
88
repository: ghcr.io/sysdiglabs/sysdig-mcp-server
99
pullPolicy: IfNotPresent
1010
# Overrides the image tag whose default is the chart appVersion.
11-
tag: "latest"
11+
tag: "v0.1.1-e789d6e"
1212

1313
imagePullSecrets: []
1414
nameOverride: ""

entrypoint.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)