Merge branch 'release' into main #14
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 Branch | |
on: | |
push: | |
branches: [main, release] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up fly | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Set variables for staging | |
run: | | |
echo "DEPLOYMENT_ENVIRONMENT=staging" >> $GITHUB_ENV | |
echo "DEPLOYMENT_URL=https://indexer-staging.fly.dev" >> $GITHUB_ENV | |
if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Set variables for production | |
run: | | |
echo "DEPLOYMENT_ENVIRONMENT=production" >> $GITHUB_ENV | |
echo "DEPLOYMENT_URL=https://indexer-production.fly.dev" >> $GITHUB_ENV | |
if: ${{ github.ref == 'refs/heads/release' }} | |
- name: Build and test | |
run: | | |
flyctl -c fly.${{ env.DEPLOYMENT_ENVIRONMENT }}.toml deploy --remote-only --build-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Deploy | |
run: | | |
flyctl -c fly.${{ env.DEPLOYMENT_ENVIRONMENT }}.toml deploy --remote-only --wait-timeout=3600 --env BUILD_TAG=`git rev-parse --short HEAD` | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Smoke test | |
run: | | |
curl --silent --show-error --fail-with-body ${{ env.DEPLOYMENT_URL }}/api/v1/status |