Skip to content

Merge pull request #1116 from crowdbotics/qa #27

Merge pull request #1116 from crowdbotics/qa

Merge pull request #1116 from crowdbotics/qa #27

Workflow file for this run

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
id: 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
id: 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 }}
- uses: act10ns/slack@v2
if: ${{ needs.set_environment.outputs.my_env }} == 'production'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}