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

Deploy to prod on tag creation #1064

Merged
merged 1 commit into from
Sep 23, 2023
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
15 changes: 10 additions & 5 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
name: Publish Docker image and deploy it

on:
release:
types: [published]
push:
branches:
- develop
- main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be worth taking off main if we are going to scrap it at some point.

- develop

env:
image_name: lucyparsons/openoversight
# env_mapping: {"develop": "staging", "main": "prod"}
env_name: ${{ fromJson(vars.env_mapping)[github.ref_name] }}
# docker_mapping: {"develop": "latest", "main": "stable"}
docker_name: ${{ fromJson(vars.docker_mapping)[github.ref_name] }}
# env_name: 'prod' if ref_type is 'tag' indicating a release, otherwise 'staging'
env_name: ${{ github.ref_type == 'tag' && 'prod' || 'staging' }}
# docker_name: 'stable' if ref_type is 'tag', otherwise 'latest'
docker_name: ${{ github.ref_type == 'tag' && 'stable' || 'latest' }}
# release version if it is a release
release_version: ${{ github.ref_type == 'tag' && github.ref_name || 'latest'}}
python_version: "3.11"

jobs:
Expand Down Expand Up @@ -42,6 +46,7 @@ jobs:
ghcr.io/${{ env.image_name }}:${{ github.sha }}
ghcr.io/${{ env.image_name }}:${{ env.docker_name }}
ghcr.io/${{ env.image_name }}:${{ env.docker_name }}-py${{ env.python_version }}
ghcr.io/${{ env.image_name }}:${{ env.release_version }}
deploy:
name: Deploy code to respective server
needs: push_to_registry
Expand Down