Improve app testing security #1424
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: 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 }} |