Deploy to OPENCREORG #375
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: "Deploy to OPENCREORG" | |
on: | |
workflow_dispatch: # allow manual triggering | |
workflow_run: | |
workflows: ["Test-e2e","Lint Code Base","Test"] | |
types: | |
- completed | |
branches: | |
- main | |
jobs: | |
deploy: | |
environment: opencreorg | |
name: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Deploy backend to heroku | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_APP_NAME: opencreorg | |
run: | | |
git config user.name spyros | |
git config user.email "[email protected]" # git just needs AN email, it doesn't matter which | |
# git fetch --all --unshallow --tags | |
highest_tag="$(git tag -l --sort=-v:refname | grep ^v | sed 1q)" | |
echo "highest tag is ${highest_tag}" | |
echo "autodeployment only supports minor tags" | |
git remote add heroku https://heroku:${{ secrets.HEROKU_API_KEY }}@git.heroku.com/opencreorg.git | |
commit_sha=$(git rev-parse origin/main) | |
major=$(echo "${highest_tag}" | cut -f1 -d. | tr -dc '0-9') | |
minor=$(echo "${highest_tag}" | cut -f2 -d. | tr -dc '0-9') | |
patch=$(echo "${highest_tag}" | cut -f3 -d. | tr -dc '0-9') | |
patch=$((patch+1)) | |
new_tag="v${major}.${minor}.${patch}" | |
echo "new tag is ${new_tag}" | |
git tag --annotate "${new_tag}" --message "${new_tag}" "${commit_sha}" | |
git push --force heroku main --follow-tags |