Skip to content

Commit

Permalink
Amend workflow conditional checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
henrychao-rcsb committed Jul 17, 2023
1 parent d3f72ca commit d8a07e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
20 changes: 4 additions & 16 deletions .github/workflows/workflow-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ on:
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."

jobs:
# Debugging inputs
debug_input:
runs-on:
- "self-hosted"
- "java"
steps:
- run: |
echo "Mainline branch input: ${{ inputs.mainline_branch }}"
echo "GitHub ref value: ${{ github.ref }}"
echo "GitHub evennt name: ${{ github.event_name }}"
echo "Evaluate if it's a mainline branch workflow: ${{ github.ref == inputs.mainline_branch }}"
echo "Evaluate if job should run: ${{ (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request') }}"
# Test projects
test_mvn:
name: "Run tests via mvn"
Expand All @@ -53,15 +41,15 @@ jobs:
# Staging jobs
build_jib_staging:
name: "Build docker image via jib with staging tag"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- build_jib
uses: ./.github/workflows/run_mvn.yaml
with:
script: package jib:build -Djib.to.tags=staging -Djib.target.namespace=rcsb --no-transfer-progress -Dmaven.test.skip=true
skaffold_deploy_staging:
name: "Skaffold deploy into staging namespace"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- build_jib_staging
uses: ./.github/workflows/deploy_skaffold.yaml
Expand All @@ -72,15 +60,15 @@ jobs:
# TODO: Increment version of project through workflow. Add this step once we are ready to retire older workflow files.
build_docker_production:
name: "Build docker image via jib with production tag"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- skaffold_deploy_staging
uses: ./.github/workflows/run_mvn.yaml
with:
script: package jib:build -Djib.to.tags=production -Djib.target.namespace=rcsb --no-transfer-progress -Dmaven.test.skip=true
skaffold_deploy_production:
name: Skaffold deploy into production environment"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- build_docker_production
uses: ./.github/workflows/deploy_skaffold.yaml
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/workflow-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
# Staging jobs
build_docker_staging:
name: "Build docker image with staging tag"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- test_npm
- build_docker
Expand All @@ -64,7 +64,7 @@ jobs:
additional_tag: "staging"
skaffold_deploy_staging:
name: "Skaffold deploy into staging namespace"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- build_docker_staging
uses: ./.github/workflows/deploy_skaffold.yaml
Expand All @@ -74,7 +74,7 @@ jobs:
# Production jobs
build_docker_production:
name: "Build docker image with production tag"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- build_docker_staging
uses: ./.github/workflow/build_docker.yaml
Expand All @@ -84,7 +84,7 @@ jobs:
additional_tag: "production"
skaffold_deploy_production:
name: Skaffold deploy into production environment"
if: (github.ref == inputs.mainline_branch) && (github.event_name != 'pull_request')
if: (github.ref == "refs/heads/${{ inputs.mainline_branch }}") && (github.event_name != 'pull_request')
needs:
- build_docker_production
uses: ./.github/workflows/deploy_skaffold.yaml
Expand Down

0 comments on commit d8a07e0

Please sign in to comment.