-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (63 loc) · 2.3 KB
/
template-only-cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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:
deploy:
name: Deploy to ${{ matrix.project_repo }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project_repo:
- navapbc/platform-test
- navapbc/platform-test-flask
- navapbc/platform-test-nextjs
- navapbc/pfml-starter-kit-app
steps:
- name: Checkout template-infra repo
uses: actions/checkout@v4
with:
path: template-infra
# 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 }}
# 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 "$(which python)" 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 platform-admins@navapbc.com
- name: Update infra template
working-directory: project-repo
run: nava-platform infra update --template-uri ../template-infra --version HEAD .
- name: Install example app
if: "${{ matrix.project_repo == 'navapbc/platform-test' }}"
run: |
# replace existing app with updated example app code
rm -rf ./project-repo/app
mv -vf ./template-infra/template-only-app ./project-repo/app
# and commit if there are changes
cd project-repo
if [[ $(git status app --porcelain | wc -l) -ne 0 ]]; then
git add app
git commit --message "Update app/ from example"
fi
- name: Push changes to project repo
working-directory: project-repo
run: git push