Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use environments when deploying #186

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

- name: Check dependencies for security vulnerabilities
uses: g-rath/check-with-osv-detector@main
build:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -26,8 +26,27 @@ jobs:
run: docker compose logs backend
- name: Run test suite
run: docker compose run backend bin/runtests.py

deploy_to_uat:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs:
- check-dependencies
- tests
environment:
name: uat
url: https://signbank-uat.nzsl.nz
steps:
- uses: actions/checkout@v1
- run: curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
- run: cp example.env .env
- name: Build the docker compose stack
run: docker compose up -d
- name: Check running containers
run: docker ps -a
- name: Check logs
run: docker compose logs backend
- name: Deploy app to UAT
if: github.ref == 'refs/heads/master'
env:
HEROKU_API_KEY: ${{secrets.HEROKU_UAT_API_KEY}}
HEROKU_APP_NAME: ${{secrets.HEROKU_UAT_APP_NAME}}
Expand All @@ -36,6 +55,25 @@ jobs:
docker tag $(docker compose images -q backend) registry.heroku.com/$HEROKU_APP_NAME/web
docker push registry.heroku.com/$HEROKU_APP_NAME/web
heroku container:release web -a $HEROKU_APP_NAME
deploy_to_production:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/production'
needs:
- check-dependencies
- tests
environment:
name: production
url: https://signbank.nzsl.nz
steps:
- uses: actions/checkout@v1
- run: curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
- run: cp example.env .env
- name: Build the docker compose stack
run: docker compose up -d
- name: Check running containers
run: docker ps -a
- name: Check logs
run: docker compose logs backend
- name: Deploy app to Production
if: github.ref == 'refs/heads/production'
env:
Expand Down
Loading