Skip to content

Commit

Permalink
Store artifacts only on main and stable branches (facebook#38954)
Browse files Browse the repository at this point in the history
Summary:
This change stores artifacts in CI only when it runs in main or in a stable branch

## Changelog:

[Internal] - Store CI artifacts only on main or on stable branches

Pull Request resolved: facebook#38954

Test Plan: CircleCI stays green and we don't store anything on pr branch

Reviewed By: cortinico

Differential Revision: D48267659

Pulled By: cipolleschi

fbshipit-source-id: 6257270948c770e09492691c995cbe84d7a085ac
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Aug 14, 2023
1 parent 2925872 commit e29b5bb
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,15 @@ commands:
condition:
equal: [ << parameters.flavor >>, "Debug"]
steps:
- store_artifacts:
- store_artifacts_if_needed:
path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-debug.tar.gz
- when:
condition:
equal: [ << parameters.flavor >>, "Release"]
steps:
- store_artifacts:
- store_artifacts_if_needed:
path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-release.tar.gz
- store_artifacts:
- store_artifacts_if_needed:
path: /tmp/hermes/osx-bin/<< parameters.flavor >>/hermesc

stop_job_if_apple_artifacts_are_there:
Expand Down Expand Up @@ -605,6 +605,31 @@ commands:
paths:
- << parameters.pods_build_folder >>

store_artifacts_if_needed:
description: "This step stores the artifacts only if we are on main or on a stable branch"
parameters:
path:
type: string
destination:
type: string
default: << parameters.path >>
when:
type: enum
enum: ['always', 'on_fail', 'on_success']
default: 'always'
steps:
- when:
condition:
or:
- equal: [ main, << pipeline.git.branch >> ]
- matches:
pattern: /0\.[0-9]+[\.[0-9]+]?-stable/
value: << pipeline.git.branch >>
steps:
- store_artifacts:
when: << parameters.when >>
path: << parameters.path >>
destination: << parameters.destination >>


# -------------------------
Expand Down Expand Up @@ -813,7 +838,7 @@ jobs:
cd /Users/distiller/Library/Developer/Xcode
XCRESULT_PATH=$(find . -name '*.xcresult')
tar -zcvf xcresults.tar.gz $XCRESULT_PATH
- store_artifacts:
- store_artifacts_if_needed:
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
# -------------------------
# Collect Results
Expand Down Expand Up @@ -1519,7 +1544,7 @@ jobs:
paths:
- /tmp/hermes/linux64-bin/
- /tmp/hermes/hermes/destroot/
- store_artifacts:
- store_artifacts_if_needed:
path: /tmp/hermes/linux64-bin/
- persist_to_workspace:
root: /tmp/hermes/
Expand Down Expand Up @@ -1794,7 +1819,7 @@ jobs:
- C:\tmp\hermes\hermes\icu\
- C:\tmp\hermes\hermes\deps\
- C:\tmp\hermes\hermes\build_release\
- store_artifacts:
- store_artifacts_if_needed:
path: C:\tmp\hermes\win64-bin\
- persist_to_workspace:
root: C:\tmp\hermes\
Expand Down Expand Up @@ -1910,7 +1935,6 @@ jobs:
- store_artifacts:
path: /tmp/maven-local.zip
- store_artifacts:
when: on_fail
path: /root/.npm/_logs
- persist_to_workspace:
root: /tmp
Expand Down

0 comments on commit e29b5bb

Please sign in to comment.