fix: A small change to test workflows. #63
Workflow file for this run
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
| # Copyright 2025 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: Release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: [main] | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| if: github.event.pull_request.merged == true | |
| env: | |
| GOOGLE_MAPS_JS_SAMPLES_KEY: "${{ secrets.GOOGLE_MAPS_JS_SAMPLES_KEY }}" | |
| steps: | |
| - name: Clear GitHub Actions Cache (Force a Miss) | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.gitconfig | |
| key: gitconfig-${{ github.run_id }} | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clear Git config cache | |
| run: | | |
| git config --global --unset-all user.name || true | |
| git config --global --unset-all user.email || true | |
| - name: Set Git Identity | |
| run: | | |
| git config --global user.name 'googlemaps-bot' | |
| git config --global user.email '[email protected]' | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node | |
| mode: 'max' | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22.x' | |
| - run: npm i | |
| - run: npm run build-all | |
| - uses: google-github-actions/auth@v1 | |
| with: | |
| credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }} | |
| - name: Install Firebase CLI | |
| run: npm install -g firebase-tools | |
| - name: Deploy to Firebase Hosting | |
| run: firebase deploy --only hosting | |
| - name: Check if the dist branch exists remotely | |
| run: | | |
| if git ls-remote --exit-code --heads origin dist; then | |
| # Delete the dist branch locally if it exists | |
| if git show-ref --verify --quiet refs/heads/dist; then | |
| git branch -D dist | |
| fi | |
| # Delete the dist branch remotely | |
| git push origin --delete dist | |
| fi | |
| - name: Checkout and create dist branch from main | |
| run: git checkout -b dist main | |
| - name: Add and commit changes to the dist folder | |
| run: | | |
| git add dist | |
| if [[ -n $(git status --porcelain) ]]; then | |
| git commit -m "Update dist folder" | |
| git push origin dist | |
| else | |
| echo "No changes to commit" | |
| fi |