feat: Implement APIs #24
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: Build Backend | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- "applications/backend/**" | |
concurrency: | |
group: build-group | |
cancel-in-progress: false | |
env: | |
PROJECT_ID: ${{ secrets.GKE_PROJECT }} | |
GAR_LOCATION: us-central1 | |
jobs: | |
setup-build-publish: | |
name: Setup, Build, Publish | |
runs-on: ubuntu-latest | |
environment: production | |
permissions: | |
contents: 'write' | |
id-token: 'write' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Set up Taskfile | |
uses: arduino/[email protected] | |
- name: Run Lint Check | |
run: task lint-check | |
- name: Run all tests | |
run: task test | |
# Authentication to GCP via credentials json | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | |
- name: Docker configuration | |
run: gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev --quiet | |
- name: Build | |
run: task build-backend-image tag="$GITHUB_SHA" | |
# Push the Docker image to Google Artifact Registry | |
- name: Publish | |
run: task push-backend-image tag="$GITHUB_SHA" | |
- name: Replace Backend Image Tag | |
run: sed -i "s/\(&backendImageTag\) [^[:space:]]*/\1 $GITHUB_SHA/g" infrastructure/k8s/folio-feed-helm/values.yaml | |
- name: Commit the Changes | |
run: | | |
git config user.name "Github Actions" | |
git config user.email [email protected] | |
git diff | |
git add infrastructure/k8s/folio-feed-helm/values.yaml | |
git commit -m "backend image update: $GITHUB_SHA" | |
git push origin main |