-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update template CD to use Platform CLI (#768)
Update template CD to: - Keep lorenyu/platform-cli branch up to date with main - Install nava-platform CLI - Use nava-platform CLI to update platform-test repos ## Context As part of migrating to use the Platform CLI we are going to first get the platform-test* repos to start updating using the Platform CLI
- Loading branch information
Showing
1 changed file
with
39 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,27 @@ on: | |
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: | ||
|
@@ -25,23 +43,36 @@ jobs: | |
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 | ||
# Fetch history because the Platform CLI needs it to do the update | ||
fetch-depth: 0 | ||
- name: Checkout project repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: project-repo | ||
repository: ${{ matrix.project_repo }} | ||
token: ${{ secrets.PLATFORM_BOT_GITHUB_TOKEN }} | ||
|
||
- name: Update infra template | ||
working-directory: project-repo | ||
run: ../template-infra/template-only-bin/update-template | ||
# 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: Push changes to project repo | ||
- name: Install nava-platform CLI | ||
run: pipx install --python python3.13 git+https://github.com/navapbc/platform-cli | ||
|
||
- name: Configure git | ||
working-directory: project-repo | ||
run: | | ||
git config user.name nava-platform-bot | ||
git config user.email [email protected] | ||
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 | ||
- 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 push |