Merge pull request #5 from code-review-platform-flow/FLOW-132 #10
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 CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Cache Docker layers | |
uses: actions/[email protected] | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Log in to Google Cloud | |
uses: google-github-actions/[email protected] | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Configure docker for gcloud | |
run: gcloud auth configure-docker asia-northeast3-docker.pkg.dev | |
- name: Build and push Docker image | |
run: | | |
docker buildx build --push \ | |
--tag asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-dev/flow-admin-main-dev:${{ github.sha }} . | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout deployment repo | |
uses: actions/[email protected] | |
with: | |
repository: code-review-platform-flow/flow-manifest | |
path: manifests | |
token: ${{ secrets.FLOW_DEPLOY_KEY }} | |
- name: List files for debugging | |
run: ls -R | |
- name: Update manifest | |
run: | | |
sed -i "s|image: .*|image: asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-dev/flow-admin-main-dev:${{ github.sha }}|" manifests/flow-admin-main-dev/deployment.yaml | |
- name: Commit and push changes | |
working-directory: manifests | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add . | |
git commit -m "Update image to asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-dev/flow-admin-main-dev:${{ github.sha }}" | |
git push |