Merge pull request #22 from feat7/ingestkit-planning #10
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write # For PyPI trusted publishing | |
| jobs: | |
| build: | |
| name: Build binaries | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: darwin | |
| goarch: amd64 | |
| suffix: '' | |
| - goos: darwin | |
| goarch: arm64 | |
| suffix: '' | |
| - goos: linux | |
| goarch: amd64 | |
| suffix: '' | |
| - goos: linux | |
| goarch: arm64 | |
| suffix: '' | |
| - goos: windows | |
| goarch: amd64 | |
| suffix: '.exe' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Build CLI binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| go build -ldflags="-s -w" -o ingestkit-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} ./cmd/cli | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ingestkit-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: ingestkit-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| for dir in artifacts/*/; do | |
| cp "$dir"* release/ 2>/dev/null || true | |
| done | |
| ls -la release/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: release/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Build and push Docker images | |
| docker: | |
| name: Build Docker images | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Build and push API image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile.api | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/api:${{ steps.version.outputs.VERSION }} | |
| ghcr.io/${{ github.repository }}/api:latest | |
| platforms: linux/amd64,linux/arm64 | |
| - name: Build and push Consumer image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile.consumer | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/consumer:${{ steps.version.outputs.VERSION }} | |
| ghcr.io/${{ github.repository }}/consumer:latest | |
| platforms: linux/amd64,linux/arm64 | |
| # Publish to PyPI | |
| publish-pypi: | |
| name: Publish to PyPI | |
| needs: release | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/ingestkit/ | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Extract version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Update version in setup.py | |
| run: | | |
| cd packages/python | |
| sed -i "s/VERSION = .*/VERSION = \"${{ steps.version.outputs.VERSION }}\"/" setup.py | |
| - name: Install build dependencies | |
| run: pip install build twine | |
| - name: Build package | |
| run: | | |
| cd packages/python | |
| python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: packages/python/dist/ | |
| # Publish to npm with provenance (cryptographic attestation) | |
| publish-npm: | |
| name: Publish to npm | |
| needs: release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for npm provenance | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Extract version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Update version in package.json | |
| run: | | |
| cd packages/npm | |
| npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version --allow-same-version | |
| - name: Publish to npm with provenance | |
| run: | | |
| cd packages/npm | |
| npm publish --access public --provenance |