You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a common deployment workflow shared across both my staging and production environments with an if condition so it only triggers for production deployments:
However, I noticed for my staging deployments, the action is still running a build / setup step at the start of my workflow that takes about 5 seconds:
Build container for action use: '/home/runner/work/_actions/rollbar/github-deploy-action/eaf2a60ea238bd273226eee0ddceecfe5611964d/Dockerfile'
I've been trying to get my deployments around a minute so this actually accounts for 5% of my total deployment time.
Is there a better way to skip this action for different environments or make the action smarter so it doesn't run this when it's being skipped?
Thanks
The text was updated successfully, but these errors were encountered:
From researching this a bit, it seems that in GitHub Actions, the container for the job (in this case Notify Rollbar of deployment) is built even if the step inside the job is eventually skipped via an if: check. But, a workaround is to wrap it inside another job, like this:
name: Deploy
on:
workflow_dispatch:
inputs:
environment:
description: "Deployment environment"
required: true
default: "staging"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Check environment
run: echo "Deploying to ${{ github.event.inputs.environment }}"
- name: Actual build/deploy steps
run: echo "Building and deploying..."
notify-rollbar:
# `needs` ensures this job won't run until after `build-and-deploy` completes
needs: build-and-deploy
# `if` ensures the entire job is skipped if environment is not production
if: ${{ github.event.inputs.environment == 'production' }}
runs-on: ubuntu-latest
steps:
- name: Notify Rollbar of deployment
uses: rollbar/github-deploy-action@eaf2a60ea238bd273226eee0ddceecfe5611964d
with:
accessToken: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}
environment: production
I have a common deployment workflow shared across both my staging and production environments with an if condition so it only triggers for production deployments:
However, I noticed for my staging deployments, the action is still running a build / setup step at the start of my workflow that takes about 5 seconds:
I've been trying to get my deployments around a minute so this actually accounts for 5% of my total deployment time.
Is there a better way to skip this action for different environments or make the action smarter so it doesn't run this when it's being skipped?
Thanks
The text was updated successfully, but these errors were encountered: