Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): push STEP files into public onshape document #777

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/linux-eic-shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,38 @@ jobs:
name: ${{matrix.detector_config}}.stp
path: ${{matrix.detector_config}}.stp
if-no-files-found: error
- name: Upload to new public OnShape document
run: |
API=https://cad.onshape.com/api/v6
CREDENTIALS=$(printf ${{secrets.ONSHAPE_ACCESS_KEY}}:${{secrets.ONSHAPE_SECRET_KEY}} | base64 --wrap=0)
# Create new public document
curl -X POST $API/documents \
-H "accept: application/json;charset=UTF-8;qs=0.09" \
-H "Authorization: Basic $CREDENTIALS" \
-H "Content-Type: application/json;charset=UTF-8;qs=0.09" \
-d '{ "name": "'${{matrix.detector_config}}_${{github.run_id}}'", "isPublic": "true" }' \
-o create.json
# Get document and workspace id
did=$(jq -r .id create.json)
wid=$(jq -r .defaultWorkspace.id create.json)
# User access link
echo "https://cad.onshape.com/documents/$did/w/$wid"
# Upload and translate STEP file
curl -X POST $API/translations/d/$did/w/$wid \
-H "accept: application/json;charset=UTF-8;qs=0.09" \
-H "Authorization: Basic $CREDENTIALS" \
-H "Content-Type: multipart/form-data" \
-F "formatName=STEP" \
-F "flattenAssemblies=true" \
-F "translate=true" \
-F "yAxisIsUp=true" \
-F "file=@${{matrix.detector_config}}.stp" \
-o upload.json
# Check on upload
tid=$(jq -r .id upload.json)
curl -X GET $API/translations/$tid \
-H "accept: application/json;charset=UTF-8;qs=0.09" \
-H "Authorization: Basic $CREDENTIALS"

dump-constants:
runs-on: ubuntu-latest
Expand Down
Loading