Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/template-only-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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: template-only-cd

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout template repo
uses: actions/checkout@v3
with:
path: template-application-flask
- name: Checkout project repo
uses: actions/checkout@v3
with:
path: project-repo
repository: navapbc/platform-test-flask
token: ${{ secrets.PLATFORM_BOT_GITHUB_TOKEN }}

- name: Update application template
working-directory: project-repo
run: ../template-application-flask/template-only-bin/update-template.sh

- name: Push changes to project repo
working-directory: project-repo
run: |
git config user.name nava-platform-bot
git config user.email platform-admins@navapbc.com
git add --all
# Commit changes (if no changes then no-op)
git diff-index --quiet HEAD || git commit -m "Template application deploy #${{ github.run_id }}"
git push
1 change: 0 additions & 1 deletion .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# List of settings and ignore or safelist findings for the hadolint scanner

# For more information on any settings you can specify, see the actions' documentation here
# https://github.com/hadolint/hadolint#configure
failure-threshold: warning
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ The template application is intended to work with the infrastructure from [templ

## Installation

To get started using the template infrastructure on your project, install the template by cloning the template repository and copying the following folders/files to your repository:

```bash
# fetch latest version of the template
git clone --single-branch --branch main --depth 1 git@github.com:navapbc/template-application-flask.git

cp -r \
template-application-flask/.github \
template-application-flask/docs \
template-application-flask/app \
template-application-flask/docker-compose.yml \
.

# clean up the template folder
rm -fr template-application-flask
```
To get started using the template application on your project:

1. Run the [download and install script](./template-only-bin/download-and-install-template.sh) in your project's root directory.

```bash
curl https://raw.githubusercontent.com/navapbc/template-application-flask/main/template-only-bin/download-and-install-template.sh | bash -s
```

This script will:

1. Clone the template repository
2. Copy the template files into your project directory
3. Remove any files specific to the template repository.
2. Optional, if using the Platform infra template: [Follow the steps in the `template-infra` README](https://github.com/navapbc/template-infra#installation) to set up the various pieces of your infrastructure.

## Getting started

Now you're ready to [get started](/docs/app/getting-started.md).
11 changes: 11 additions & 0 deletions template-only-bin/download-and-install-template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail

echo "Fetch latest version of template-application-flask"
git clone --single-branch --branch main --depth 1 git@github.com:navapbc/template-application-flask.git

echo "Install template"
./template-application-flask/template-only-bin/install-template.sh

echo "Clean up template-application-flask folder"
rm -fr template-application-flask
24 changes: 24 additions & 0 deletions template-only-bin/install-template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# This script installs template-application-flask to your project. Run
# This script from your project's root directory.
set -euo pipefail

CUR_DIR=$(pwd)
SCRIPT_DIR=$(dirname $0)
TEMPLATE_DIR="$SCRIPT_DIR/.."

echo "Copy files from template-application-flask"
cd $TEMPLATE_DIR
cp -r \
.github \
.dockleconfig \
.hadolint.yaml \
app \
docker-compose.yml \
docs \
$CUR_DIR
cd -

echo "Remove files relevant only to template development"
rm .github/workflows/template-only-*
10 changes: 10 additions & 0 deletions template-only-bin/update-template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
#
# This script updates template-application-flask in your project. Run
# This script from your project's root directory.
set -euo pipefail

SCRIPT_DIR=$(dirname $0)

echo "Install template"
$SCRIPT_DIR/install-template.sh