feat: add validation for circle before publishing (#20) #32
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: Dev Deployment | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Create .env file | |
run: | | |
echo "${{ secrets.ENV_DEVELOPMENT }}" > .env | |
- name: Login to Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.SERVICE_ACCOUNT }} | |
- name: Docker auth | |
run: | | |
gcloud auth configure-docker ${{ vars.DOCKER_REGISTRY_LOCATION }} --quiet | |
- name: Build and push Docker image | |
run: | | |
docker buildx build --tag ${{ vars.DOCKER_REGISTRY_LOCATION }}/${{ secrets.GOOGLE_PROJECT }}/inner-catalog/catalog-ui:dev-${{ github.run_id }} --push . | |
deploy: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Login to google cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.SERVICE_ACCOUNT }} | |
- name: Deploy to Cloud Run | |
uses: google-github-actions/deploy-cloudrun@v2 | |
with: | |
service: catalog-ui-dev | |
image: ${{ vars.DOCKER_REGISTRY_LOCATION }}/${{ secrets.GOOGLE_PROJECT }}/inner-catalog/catalog-ui:dev-${{ github.run_id }} | |
region: asia-southeast2 | |
flags: '--allow-unauthenticated --port=3000 --memory=256Mi --cpu=1 --min-instances=0 --max-instances=1 --cpu-throttling' |