-
Notifications
You must be signed in to change notification settings - Fork 9
32 lines (32 loc) · 1.37 KB
/
heroku_deploy.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
name: Heroku
on: [push]
jobs:
Setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jwalton/gh-find-current-pr@master
id: findPr
- name: Set app_name for Staging
run: echo "APP_NAME=tn-spa-bootstrapper-staging" >> $GITHUB_ENV
- name: Set app_name for PR
if: success() && steps.findPr.outputs.number
run: echo "APP_NAME=tn-spa-bootstrapper-pr-${PR}" >> $GITHUB_ENV
env:
PR: ${{ steps.findPr.outputs.pr }}
- name: Update Heroku on what type of app to build next time (Vue or React)
run: |
config_file=$(./scripts/vue_or_react.sh)
current_config=$(heroku config:get BUILDPACK_RUN --app=${{ env.APP_NAME }})
echo "Configuration was set with ${config_file}"
if echo "$current_config" | grep -q "config_file"; then
echo "Keeping current config of $config_file"
else
echo "Switching Heroku to build with $config_file instead"
heroku plugins:install heroku-builds
heroku builds:cache:purge --app=${{ env.APP_NAME }} --confirm=${{ env.APP_NAME }}
heroku config:set BUILDPACK_RUN="pipenv run cookiecutter . --config-file $config_file --no-input -f" --app=${{ env.APP_NAME }}
fi
cat $config_file
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}