Template Deploy #345
Workflow file for this run
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: Template Deploy | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
# Only allow one workflow at a time to prevent race conditions when pushing changes to the project repo | |
concurrency: platform-template-only-cd | |
jobs: | |
# TODO: Get rid of this job once we've merged the platform-cli branch into the main branch | |
update-platform-cli-branch: | |
name: Update platform-cli branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout template-infra repo | |
uses: actions/checkout@v4 | |
with: | |
path: template-infra | |
ref: lorenyu/platform-cli | |
# Fetch history of all branches so we can merge main into the feature branch | |
fetch-depth: 0 | |
- name: Update | |
working-directory: template-infra | |
run: | | |
git merge origin/main | |
git push | |
deploy: | |
name: Deploy to ${{ matrix.project_repo }} | |
runs-on: ubuntu-latest | |
needs: update-platform-cli-branch | |
strategy: | |
fail-fast: true | |
matrix: | |
project_repo: | |
- navapbc/platform-test | |
# - navapbc/platform-test-flask | |
# - navapbc/platform-test-nextjs | |
steps: | |
- name: Checkout template-infra repo | |
uses: actions/checkout@v4 | |
with: | |
path: template-infra | |
# TODO: Revert to checking out main once we've merged the platform-cli branch into the main branch | |
ref: lorenyu/platform-cli | |
- name: Checkout project repo | |
uses: actions/checkout@v4 | |
with: | |
path: project-repo | |
# TODO: Revert to checking out main once we've tested that the update works | |
ref: lorenyu/platform-cli | |
repository: ${{ matrix.project_repo }} | |
token: ${{ secrets.PLATFORM_BOT_GITHUB_TOKEN }} | |
# Set up Python since built in Python version (3.10.12) is not supported by Platform CLI (<4.0,>=3.11) | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install nava-platform CLI | |
run: pipx install --python python3.13 git+https://github.com/navapbc/platform-cli | |
- name: Configure git | |
run: | | |
git config user.name nava-platform-bot | |
git config user.email platform-admins@navapbc.com | |
- name: Update infra template | |
working-directory: project-repo | |
run: nava-platform infra update --template-uri ../template-infra --version lorenyu/platform-cli . | |
- name: Push changes to project repo | |
working-directory: project-repo | |
run: | | |
git add --all | |
# Commit changes (if no changes then no-op) | |
git diff-index --quiet HEAD || git commit -m "Template infra deploy #${{ github.run_id }}" | |
# git push |