Bump API and Android app versions: update API to 1.53.0 and Android v… #132
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: API Release | |
| on: | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - 'backend/api/package.json' | |
| - '.github/workflows/cd-api.yml' | |
| jobs: | |
| check-version: | |
| name: Check Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed: ${{ steps.check.outputs.changed }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Read current version | |
| id: current | |
| run: | | |
| current=$(jq -r '.version' backend/api/package.json) | |
| echo "version=$current" >> $GITHUB_OUTPUT | |
| - name: Read previous version | |
| id: previous | |
| run: | | |
| if git show HEAD^:backend/api/package.json >/dev/null 2>&1; then | |
| previous=$(git show HEAD^:backend/api/package.json | jq -r '.version') | |
| else | |
| previous="none" | |
| fi | |
| echo "version=$previous" >> $GITHUB_OUTPUT | |
| - name: Compare versions | |
| id: check | |
| run: | | |
| echo "current=${{ steps.current.outputs.version }}" | |
| echo "previous=${{ steps.previous.outputs.version }}" | |
| if [ "${{ steps.current.outputs.version }}" = "${{ steps.previous.outputs.version }}" ]; then | |
| echo "Version unchanged. Skipping deploy." | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| needs: check-version | |
| if: needs.check-version.outputs.changed == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/setup | |
| - name: Authenticate to GCP | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| credentials_json: ${{ secrets.GCP_SA_KEY }} | |
| - name: Install gcloud CLI | |
| uses: google-github-actions/setup-gcloud@v2 | |
| with: | |
| project_id: compass-130ba | |
| - name: Configure Docker for Artifact Registry | |
| run: gcloud auth configure-docker us-west1-docker.pkg.dev --quiet | |
| - name: Run deploy script | |
| run: | | |
| chmod +x backend/api/deploy-api.sh | |
| backend/api/deploy-api.sh |