Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d68562f25 | |||
| 88894c4098 | |||
| e598aac514 | |||
| 94ef717fde | |||
| d75eed9a05 | |||
| 7339de2094 | |||
| a444b30ba0 | |||
| 1d7dfb167a | |||
| 008772a47e | |||
| 5d41ad720f | |||
| a7568a91bd | |||
| ef6a3b899f | |||
| 3ea9375091 | |||
| 9992edd0e7 | |||
| 8f046e505b |
+45
-12
@@ -15,10 +15,9 @@ inputs:
|
||||
speckle_function_id:
|
||||
description: 'The unique identifier of the function. Go to Speckle Automate to register your Function and get its Identifier.'
|
||||
required: true
|
||||
speckle_function_input_schema:
|
||||
description: 'JSON Schema defining the parameters required by the Function. These will be used to create the User Interface displayed to users of your Function in Speckle Automate. Users will be able to provide their data to customise the Function.'
|
||||
speckle_function_input_schema_file_path:
|
||||
description: 'File path containing JSON Schema of the parameters object required by the function. These will be used to create the User Interface displayed to users of your Function in Speckle Automate. Users will be able to provide their data to customise the Function.'
|
||||
required: false
|
||||
default: './input-schema.json'
|
||||
speckle_function_command:
|
||||
description: 'The command to run to execute the function in a runtime environment.'
|
||||
required: true
|
||||
@@ -34,25 +33,59 @@ runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.3 # checkout the repository in which this GitHub Action is being used.
|
||||
- name: Speckle Automate function version publisher
|
||||
uses: specklesystems/speckle-automate-github-action@0.2.3
|
||||
with:
|
||||
speckle_automate_url: ${{ inputs.speckle_automate_url }}
|
||||
speckle_token: ${{ inputs.speckle_token }}
|
||||
speckle_function_id: ${{ inputs.speckle_function_id }}
|
||||
speckle_function_input_schema: ${{ inputs.speckle_function_input_schema }}
|
||||
speckle_function_command: ${{ inputs.speckle_function_command }}
|
||||
- name: Set Version tag
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Determining Release tag value"
|
||||
|
||||
if [[ ${GITHUB_REF_TYPE} == "tag" ]]
|
||||
then
|
||||
echo "Workflow triggered by a git tag"
|
||||
RELEASE_TAG=${GITHUB_REF_NAME}
|
||||
else
|
||||
echo "Workflow triggered on a git branch"
|
||||
RELEASE_TAG=$(git rev-parse --short ${GITHUB_SHA})
|
||||
fi
|
||||
|
||||
echo "Setting the function's releaseTag to: ${RELEASE_TAG}"
|
||||
echo "releaseTag=${RELEASE_TAG}" >> "$GITHUB_ENV"
|
||||
- name: Log in to Speckle Automate Docker registry
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
registry: ${{ inputs.speckle_automate_url }}
|
||||
username: ${{ inputs.speckle_token }}
|
||||
password: ${{ inputs.speckle_token }}
|
||||
- name: Parse automate host
|
||||
shell: bash
|
||||
run: |
|
||||
AUTOMATE_HOST=$(python -c 'from urllib.parse import urlparse; print(urlparse("${{ inputs.speckle_automate_url }}").netloc)')
|
||||
echo "Parsed automate host: ${AUTOMATE_HOST}"
|
||||
echo "automateHost=${AUTOMATE_HOST}" >>"$GITHUB_ENV"
|
||||
- name: Ensure image doesn't exist in registry
|
||||
shell: bash
|
||||
run: |
|
||||
set +e
|
||||
docker manifest inspect ${{ env.automateHost }}/${{ inputs.speckle_function_id }}:${{ env.releaseTag }}
|
||||
if [[ $? == 0 ]]
|
||||
then
|
||||
echo "Cannot override the existing release tag ${{ env.releaseTag }}. Please publish a new release!"
|
||||
exit 1
|
||||
fi
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4.1.1
|
||||
with:
|
||||
context: ${{ inputs.docker_context }}
|
||||
file: ${{ inputs.dockerfile_path }}
|
||||
tags: ${{ steps.register-speckle-function-version.outputs.speckle_automate_host }}/${{ inputs.speckle_function_id }}:${{ steps.register-speckle-function-version.outputs.version_id }}
|
||||
tags: ${{ env.automateHost }}/${{ inputs.speckle_function_id }}:${{ env.releaseTag }}
|
||||
target: ''
|
||||
push: true
|
||||
- name: Speckle Automate function version publisher
|
||||
uses: specklesystems/speckle-automate-github-action@0.6.1
|
||||
id: register_speckle_function_version
|
||||
with:
|
||||
speckle_automate_url: ${{ inputs.speckle_automate_url }}
|
||||
speckle_token: ${{ inputs.speckle_token }}
|
||||
speckle_function_id: ${{ inputs.speckle_function_id }}
|
||||
speckle_function_input_schema_file_path: ${{ inputs.speckle_function_input_schema_file_path }}
|
||||
speckle_function_release_tag: ${{ env.releaseTag }}
|
||||
speckle_function_command: ${{ inputs.speckle_function_command }}
|
||||
|
||||
Reference in New Issue
Block a user