Skip to content

Commit

Permalink
Simplify conditional expression in workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
henrychao-rcsb committed Oct 2, 2024
1 parent ed6d8e0 commit 62ebc41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/workflow-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
inputs:
mainline_branch:
type: string
default: ${{ format('refs/heads/{0}', github.event.repository.default_branch) }}
description: "The mainline branch for the repo. Deployments to the staging and production environments are done only on push to this branch. Defaults to the repo's default branch."
default: "master"
description: "The mainline branch for the repo. Deployments to the staging and production environments are done only on push to this branch. Defaults to the master branch."
repo_url:
type: string
default: "harbor.devops.k8s.rcsb.org"
Expand Down Expand Up @@ -52,8 +52,8 @@ on:
inputs:
mainline_branch:
type: string
default: ${{ format('refs/heads/{0}', github.event.repository.default_branch) }}
description: "The mainline branch for the repo. Deployments to the staging and production environments are done only on push to this branch. Defaults to the repo's default branch."
default: "master"
description: "The mainline branch for the repo. Deployments to the staging and production environments are done only on push to this branch. Defaults to the master branch."
repo_url:
type: string
default: "harbor.devops.k8s.rcsb.org"
Expand Down Expand Up @@ -92,8 +92,7 @@ jobs:
echo "inputs.do_production_build: ${{ inputs.do_production_build }}"
echo "github.ref: ${{ github.ref }}"
echo "inputs.mainline_branch: ${{ inputs.mainline_branch }}"
echo "formatted mainline_branch: ${{ format('refs/heads/{0}', inputs.mainline_branch) }}"
echo "Is github.ref == format('refs/heads/{0}', inputs.mainline_branch): ${{ github.ref == format('refs/heads/{0}', inputs.mainline_branch) }}"
echo "Is github.ref_name == inputs.mainline_branch: ${{ github.ref_name == inputs.mainline_branch }}"
echo "github.event_name: ${{ github.event_name }}"
echo "Is github.event_name != 'pull_request': ${{ github.event_name != 'pull_request' }}"
echo "inputs.do_staging_build: ${{ inputs.do_staging_build }}"
Expand Down Expand Up @@ -142,7 +141,7 @@ jobs:
name: "Push docker image with staging tag"
if: |
github.event.inputs.do_staging_build == 'true' &&
github.ref == format('refs/heads/{0}', github.event.inputs.mainline_branch) &&
github.ref_name == inputs.mainline_branch &&
github.event_name != 'pull_request'
needs:
- test_npm
Expand All @@ -159,7 +158,7 @@ jobs:
if: |
github.event.inputs.restart_staging_deployment == 'true' &&
github.event.inputs.staging_k8s_deployment_name &&
github.ref == format('refs/heads/{0}', github.event.inputs.mainline_branch) &&
github.ref_name == inputs.mainline_branch &&
github.event_name != 'pull_request'
needs:
- build_docker_staging
Expand All @@ -177,7 +176,7 @@ jobs:
name: "Push docker image with production tag"
if: |
github.event.inputs.do_production_build == 'true' &&
github.ref == format('refs/heads/{0}', inputs.mainline_branch) &&
github.ref_name == inputs.mainline_branch &&
github.event_name != 'pull_request'
needs:
- test_npm
Expand All @@ -194,7 +193,7 @@ jobs:
if: |
github.event.inputs.restart_production_deployment == 'true' &&
github.event.inputs.production_k8s_deployment_name &&
github.ref == format('refs/heads/{0}', inputs.mainline_branch) &&
github.ref_name == inputs.mainline_branch &&
github.event_name != 'pull_request'
needs:
- build_docker_production
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
name: "Run automated workflow"
uses: rcsb/devops-cicd-github-actions/.github/workflows/workflow-node.yaml@master
with:
mainline_branch: # The mainline branch for the repo. Deployments to the staging and production environments are done only on push to this branch. Defaults to the repo's default branch.
mainline_branch: # The mainline branch for the repo. Deployments to the staging and production environments are done only on push to this branch. Defaults to the master branch.
repo_url: # The URL of the remote Docker image repository. Defaults to harbor.devops.k8s.rcsb.org.
repo_project: # REQUIRED. The name of the project or organization in the remote Docker image repository.
docker_image_name: # REQUIRED. The name of the Docker image to create.
Expand Down

0 comments on commit 62ebc41

Please sign in to comment.