|
| 1 | +--- |
1 | 2 | name: Publish Docker image |
2 | 3 |
|
3 | 4 | on: |
4 | 5 | push: |
5 | 6 | branches: |
6 | 7 | - main |
| 8 | + - beta |
7 | 9 | paths: |
8 | 10 | - pyproject.toml |
| 11 | + - Dockerfile |
| 12 | + - '*.py' |
| 13 | + - tests/** |
| 14 | + - tools/** |
| 15 | + - utils/** |
9 | 16 | workflow_dispatch: |
10 | | - inputs: |
11 | | - version: |
12 | | - description: "Version to publish" |
13 | | - required: false |
14 | | - default: "latest" |
15 | | - type: string |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: 'publish-${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' |
| 20 | + cancel-in-progress: true |
16 | 21 |
|
17 | 22 | jobs: |
| 23 | + tests: |
| 24 | + permissions: |
| 25 | + checks: write |
| 26 | + pull-requests: write |
| 27 | + contents: write |
| 28 | + uses: ./.github/workflows/test.yaml |
| 29 | + secrets: inherit |
18 | 30 | push_to_registry: |
19 | 31 | name: Push Docker image to GitHub Packages |
20 | 32 | runs-on: ubuntu-latest |
| 33 | + needs: tests |
21 | 34 | permissions: |
22 | 35 | contents: read # required for actions/checkout |
23 | 36 | packages: write # required for pushing to ghcr.io |
24 | 37 | id-token: write # required for signing with cosign |
| 38 | + outputs: |
| 39 | + version: ${{ steps.extract_version.outputs.VERSION }} |
| 40 | + tag: ${{ steps.extract_version.outputs.TAG }} |
25 | 41 | steps: |
26 | 42 | - name: Check out the repo |
27 | 43 | uses: actions/checkout@v4 |
28 | 44 |
|
29 | 45 | - name: Extract version |
30 | 46 | id: extract_version |
31 | 47 | run: | |
32 | | - VERSION=$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/')-$(echo $GITHUB_SHA | cut -c1-7) |
| 48 | + VERSION=$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/') |
33 | 49 | echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" |
| 50 | + TAG=v$(grep 'version =' pyproject.toml | sed -e 's/version = "\(.*\)"/\1/') |
| 51 | + echo "TAG=$TAG" >> "$GITHUB_OUTPUT" |
34 | 52 |
|
35 | 53 | - name: Log in to GitHub Container Registry |
36 | 54 | uses: docker/login-action@v3 |
|
61 | 79 | ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ steps.extract_version.outputs.VERSION }} |
62 | 80 | DIGEST: ${{ steps.build-and-push.outputs.digest }} |
63 | 81 | run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |
| 82 | + |
| 83 | + tag_release: |
| 84 | + name: Tag Release |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: push_to_registry |
| 87 | + steps: |
| 88 | + - name: Check out repository |
| 89 | + uses: actions/checkout@v4 |
| 90 | + with: |
| 91 | + ref: ${{ github.sha }} # required for better experience using pre-releases |
| 92 | + fetch-depth: '0' # Required due to the way Git works, without it this action won't be able to find any or the correct tags |
| 93 | + |
| 94 | + - name: Get tag version |
| 95 | + id: semantic_release |
| 96 | + uses: anothrNick/github-tag-action@1.71.0 |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 99 | + DEFAULT_BUMP: "patch" |
| 100 | + TAG_CONTEXT: 'repo' |
| 101 | + WITH_V: true |
| 102 | + PRERELEASE_SUFFIX: "beta" |
| 103 | + PRERELEASE: ${{ (github.base_ref == 'beta') && 'true' || (github.base_ref == 'main') && 'false' || (github.base_ref == 'integration') && 'false' || 'true' }} |
| 104 | + |
| 105 | + - name: Summary |
| 106 | + run: | |
| 107 | + echo "## Release Summary |
| 108 | + - Tag: ${{ steps.semantic_release.outputs.tag }} |
| 109 | + - Docker Image: ghcr.io/sysdiglabs/sysdig-mcp-server:v${{ needs.push_to_registry.outputs.version }}" >> $GITHUB_STEP_SUMMARY |
| 110 | +
|
| 111 | + test_helm_chart: |
| 112 | + name: Test Helm Chart |
| 113 | + needs: push_to_registry |
| 114 | + permissions: |
| 115 | + contents: read # required for actions/checkout |
| 116 | + pull-requests: write # required for creating a PR with the chart changes |
| 117 | + uses: ./.github/workflows/helm_test.yaml |
| 118 | + secrets: inherit |
0 commit comments