added support for custom project name in add module command (#990) #180
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: Release | |
on: | |
push: | |
branches: | |
- master | |
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 == master ]; then | |
echo "my_env=staging" >> $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 }} | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Add JIRA label | |
run: | | |
git fetch --tags | |
git log --oneline --no-decorate HEAD...$(git tag -l '202[0-9]????.*' --sort=-v:refname | head -n 1) | grep -Eo '([A-Z]{3,}-)([0-9]+)' | uniq > jira_ticket.txt | |
cat jira_ticket.txt | |
if [ $GITHUB_REF_NAME == master ]; then | |
for i in $(cat jira_ticket.txt); do curl -X PUT -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.JIRA_TOKEN }}" --data '{"update":{"labels":[{"add":"staging"}]}}' https://crowdbotics.atlassian.net/rest/api/3/issue/$i ; done | |
fi | |
if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+$ ]]; then | |
for i in $(cat jira_ticket.txt); do curl -X PUT -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.JIRA_TOKEN }}" --data '{"update":{"labels":[{"add":"released"}]}}' https://crowdbotics.atlassian.net/rest/api/3/issue/$i ; done | |
fi |