chore: test OPA build workflow with OPA SA #17
This file contains 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: OPA Service CI/CD | |
on: | |
push: | |
branches: | |
- 'infra' | |
# paths: | |
# - 'opa-service/**' | |
jobs: | |
build-and-deploy-opa: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Google Cloud Auth | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_OPA_DEVELOPER }} | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: | | |
cd opa-service | |
docker build -t cdxvy30/opa-service:latest . | |
- name: Push Docker image to Docker Hub | |
run: | | |
docker push cdxvy30/opa-service:latest | |
- name: Deploy to Cloud Run | |
run: | | |
gcloud run deploy opa-service \ | |
--image docker.io/cdxvy30/opa-service:latest \ | |
--region ${{ secrets.GCP_REGION }} \ | |
--platform managed \ | |
--allow-unauthenticated |