fix: test issue #1371
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Docker Image and Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - ".github/**" | |
| - "docs/**" | |
| - "*.md" | |
| release: | |
| types: [prereleased, released] | |
| jobs: | |
| publish-package: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'release' }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| VERSION=${{ github.event.release.tag_name }} | |
| VERSION_NO_V=${VERSION#v} | |
| echo "version=${VERSION_NO_V}" >> $GITHUB_OUTPUT | |
| - name: Update version in pyproject.toml | |
| run: | | |
| sed -i 's/version = ".*"/version = "${{ steps.version.outputs.version }}"/' pyproject.toml | |
| - name: Update version in __init__.py | |
| run: | | |
| cd intentkit | |
| sed -i 's/__version__ = ".*"/__version__ = "${{ steps.version.outputs.version }}"/' __init__.py | |
| - name: Build package | |
| run: | | |
| uv build | |
| - name: Publish to PyPI | |
| run: | | |
| uv publish --token ${{ secrets.UV_PUBLISH_TOKEN }} dist/* | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Build Start | |
| id: ci_start | |
| uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d | |
| with: | |
| method: chat.postMessage | |
| token: ${{ secrets.SLACK_BOT_TOKEN }} | |
| payload: | | |
| channel: ${{ secrets.SLACK_CHANNEL }} | |
| text: "Build started 👀" | |
| attachments: | |
| - color: "dbab09" | |
| fields: | |
| - title: "Repository" | |
| short: true | |
| value: ${{ github.repository }} | |
| - title: "Status" | |
| short: true | |
| value: "In Progress" | |
| - title: "Branch" | |
| short: true | |
| value: ${{ github.ref }} | |
| - title: "Author" | |
| short: true | |
| value: ${{ github.actor }} | |
| - title: "Action" | |
| value: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| - title: "Diff" | |
| value: ${{ github.event.head_commit.url }} | |
| - title: "Changes" | |
| value: ${{ toJSON(github.event.head_commit.message) }} | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 | |
| with: | |
| # list of Docker images to use as base name for tags | |
| images: | | |
| crestal/intentkit | |
| # generate Docker tags based on the following events/attributes | |
| tags: | | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=raw,value=dev,enable=${{ github.event_name == 'release' && github.event.action == 'prereleased' }} | |
| type=raw,value=prod,enable=${{ github.event_name == 'release' && github.event.action == 'released' }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
| with: | |
| username: crestal | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 | |
| with: | |
| build-args: | | |
| RELEASE=${{ github.event.release.tag_name || 'latest'}} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build Success | |
| if: ${{ success() }} | |
| uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d | |
| with: | |
| method: chat.update | |
| token: ${{ secrets.SLACK_BOT_TOKEN }} | |
| payload: | | |
| channel: ${{ secrets.SLACK_CHANNEL }} | |
| ts: "${{ steps.ci_start.outputs.ts }}" | |
| text: "Build Succeeded ✅" | |
| attachments: | |
| - color: "28a745" | |
| fields: | |
| - title: "Repository" | |
| short: true | |
| value: ${{ github.repository }} | |
| - title: "Status" | |
| short: true | |
| value: "Completed" | |
| - title: "Branch" | |
| short: true | |
| value: ${{ github.ref }} | |
| - title: "Author" | |
| short: true | |
| value: ${{ github.actor }} | |
| - title: "Image" | |
| value: https://hub.docker.com/r/crestal/intentkit/tags | |
| - title: "Diff" | |
| value: ${{ github.event.head_commit.url }} | |
| - title: "Changes" | |
| value: ${{ toJSON(github.event.head_commit.message) }} | |
| - name: Build Failure | |
| if: ${{ failure() }} | |
| uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d | |
| with: | |
| method: chat.update | |
| token: ${{ secrets.SLACK_BOT_TOKEN }} | |
| payload: | | |
| channel: ${{ secrets.SLACK_CHANNEL }} | |
| ts: "${{ steps.ci_start.outputs.ts }}" | |
| text: "Build Failed ❌" | |
| attachments: | |
| - color: "dc3545" | |
| fields: | |
| - title: "Repository" | |
| short: true | |
| value: ${{ github.repository }} | |
| - title: "Status" | |
| short: true | |
| value: "Failed" | |
| - title: "Branch" | |
| short: true | |
| value: ${{ github.ref }} | |
| - title: "Author" | |
| short: true | |
| value: ${{ github.actor }} | |
| - title: "Action" | |
| value: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| - title: "Diff" | |
| value: ${{ github.event.head_commit.url }} | |
| - title: "Changes" | |
| value: ${{ toJSON(github.event.head_commit.message) }} |