Skip to content

Commit

Permalink
[#385] Refine GitHub Actions workflow for optimized Docker image hand…
Browse files Browse the repository at this point in the history
…ling

Optimized the build-and-deploy GitHub Actions workflow to streamline the
deployment process. Removed redundant `make docker-login` and `make
build-[backend|frontend]` steps, focusing directly on pushing the
pre-built Docker images with `make push-backend` and `make
push-frontend`. Added a crucial verification step to ensure the
deployment environment is properly defined, enhancing the reliability of
the deployment pipeline. This update ensures a more efficient and
error-resilient deployment process by minimizing unnecessary steps and
reinforcing environmental checks.
  • Loading branch information
placek committed Mar 5, 2024
1 parent d72aba6 commit 6f85c57
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- name: Check environment exists
run: |
make check-env-defined
build_backend:
name: Build and push backend Docker image
if: ${{ ! inputs.skip_build }}
Expand All @@ -69,9 +70,8 @@ jobs:
aws-region: eu-west-1
- name: Build and push images
run: |
make docker-login
make build-backend
make push-backend
build_frontend:
name: Build and push frontend Docker image
if: ${{ ! inputs.skip_build }}
Expand Down Expand Up @@ -99,11 +99,10 @@ jobs:
GTM_ID: ${{ secrets.GTM_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
run: |
make docker-login
if [[ "${{ inputs.environment }}" == "staging" ]]; then export DOMAIN=staging.govtool.byron.network; fi;
if [[ "${{ inputs.environment }}" == "beta" ]]; then export DOMAIN=sanchogov.tools; fi;
make build-frontend
make push-frontend
deploy:
name: Deploy app
needs:
Expand Down Expand Up @@ -143,24 +142,11 @@ jobs:
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.GHA_SSH_PRIVATE_KEY }}
- name: Prepare and upload app config
run: |
if [[ "${{ inputs.environment }}" == "staging" ]]; then export DOMAIN=staging.govtool.byron.network; fi;
if [[ "${{ inputs.environment }}" == "beta" ]]; then export DOMAIN=sanchogov.tools; fi;
export DOMAIN=${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}
make prepare-config
make upload-config
- name: Destroy Cardano Node, DB sync and Postgres if required
if: ${{ inputs.resync_cardano_node_and_db }}
run: |
if [[ "${{ inputs.environment }}" == "staging" ]]; then export DOMAIN=staging.govtool.byron.network; fi;
if [[ "${{ inputs.environment }}" == "beta" ]]; then export DOMAIN=sanchogov.tools; fi;
make destroy-cardano-node-and-dbsync;
- name: Deploy app
run: |
make docker-login
if [[ "${{ inputs.environment }}" == "staging" ]]; then export DOMAIN=staging.govtool.byron.network; fi;
if [[ "${{ inputs.environment }}" == "beta" ]]; then export DOMAIN=sanchogov.tools; fi;
export DOMAIN=${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}
make deploy-stack
- name: Reprovision Grafana
run: |
Expand All @@ -178,7 +164,9 @@ jobs:
run: |
if [[ "${{ inputs.environment }}" == "staging" ]]; then export DOMAIN=staging.govtool.byron.network; fi;
if [[ "${{ inputs.environment }}" == "beta" ]]; then export DOMAIN=sanchogov.tools; fi;
export DOMAIN=${DOMAIN:-$ENVIRONMENT-$CARDANO_NETWORK.govtool.byron.network}
make notify
deploy_without_build:
name: Deploy app without building
if: ${{ inputs.skip_build }}
Expand Down

0 comments on commit 6f85c57

Please sign in to comment.