diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 298438266..43d44f875 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -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