Implement gke sidecar #1
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 and Publish to Registry | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: pdm-project/setup-pdm@v4 | |
| with: | |
| python-version: "3.13" | |
| cache: true | |
| - name: Install dependencies | |
| run: pdm install --check | |
| - name: Run tests | |
| run: pdm run pytest | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract branch name | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| BRANCH_NAME="${{ github.head_ref }}" | |
| else | |
| BRANCH_NAME="${GITHUB_REF_NAME#refs/heads/}" | |
| fi | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
| - name: Authenticate to GCP with OIDC | |
| id: auth | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: ${{ vars.WIP_PROVIDER }} | |
| service_account: ${{ vars.SERVICE_ACCOUNT }} | |
| - name: Configure Docker for Artifact Registry | |
| run: | | |
| gcloud auth configure-docker us-docker.pkg.dev | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and tag Docker image | |
| run: | | |
| docker build -t us-docker.pkg.dev/koreo-dev/koreo-dev/gke-auth-sidecar:$BRANCH_NAME . | |
| - name: Push image to Artifact Registry | |
| run: | | |
| docker push us-docker.pkg.dev/koreo-dev/koreo-dev/gke-auth-sidecar:$BRANCH_NAME |