Merge pull request #1098 from crowdbotics/qa #18
Workflow file for this run
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: build-deploy | |
on: | |
push: | |
branches: | |
- develop | |
tags: | |
- "[0-9]+.[0-9]+" | |
jobs: | |
set_environment: | |
outputs: | |
my_env: ${{ steps.setenv.outputs.my_env }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: setenv | |
run: | | |
if [ $GITHUB_REF_NAME == develop ]; then | |
echo "my_env=staging" >> $GITHUB_OUTPUT | |
fi | |
if [ "${{ github.event.client_payload.deployment_branch }}" == "master" ]; then | |
echo "my_env=Production" >> $GITHUB_OUTPUT | |
fi | |
if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+$ ]]; then | |
echo "release tag: $GITHUB_REF_NAME" | |
echo "my_env=production" >> $GITHUB_OUTPUT | |
fi | |
release: | |
runs-on: ubuntu-latest | |
needs: set_environment | |
environment: | |
name: ${{ needs.set_environment.outputs.my_env }} | |
name: ${{ needs.set_environment.outputs.my_env }}-release | |
steps: | |
- name: Generate Heroku Config | |
run: | | |
cat <<EOF > ~/.netrc | |
machine api.heroku.com | |
login ${{ secrets.HEROKU_EMAIL }} | |
password ${{ secrets.HEROKU_API_TOKEN }} | |
machine git.heroku.com | |
login ${{ secrets.HEROKU_EMAIL }} | |
password ${{ secrets.HEROKU_API_TOKEN }} | |
EOF | |
- name: release modules | |
run: | | |
heroku config:set MODULES_REPO_BRANCH=$GITHUB_REF_NAME -a ${{ secrets.HEROKU_APP }} | |
heroku run 'python manage.py update_crowdbotics_components --quiet --no-input --no-log-file --public' --size=standard-2x -a ${{ secrets.HEROKU_APP }} |