forked from eclipse-tractusx/sldt-semantic-models
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (64 loc) · 2.16 KB
/
upload-single-model.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
#
# See the AUTHORS file(s) distributed with this work for additional
# information regarding authorship.
#
# See the LICENSE file(s) distributed with this work for
# additional information regarding license terms.
#
name: Upload Single Model
on:
workflow_dispatch:
inputs:
modelname:
description: 'Path of the model to be uploaded'
required: true
default: 'model_path'
jobs:
upload-models:
name: 00 Upload Models
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- name: set environment variables
run: |
echo "WORKSPACE_UPPERCASE=INT" >> $GITHUB_ENV
- name: Checkout files
uses: actions/checkout@v3
- name: validate changes from PR
uses: ./.github/actions/validate-single
with:
IS_MAIN: ${{ github.event.inputs.modelname }}
- name: Archive
uses: actions/upload-artifact@v3
with:
name: output
path: toArchive
- name: Fetch Access Token
id: token_request
env:
CLIENT_ID: ${{ secrets[format('CLIENT_ID_{0}', env.WORKSPACE_UPPERCASE)] }}
CLIENT_SECRET: ${{ secrets[format('CLIENT_SECRET_{0}', env.WORKSPACE_UPPERCASE)] }}
IDP_URL: ${{ secrets[format('IDP_URL_{0}', env.WORKSPACE_UPPERCASE)] }}
run: |
response=$(curl --request POST \
--url "https://$IDP_URL" \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode grant_type=client_credentials \
--data-urlencode client_id=$CLIENT_ID \
--data-urlencode client_secret=$CLIENT_SECRET )
access_token=$( echo $response | jq -r '.access_token' )
if [ $access_token == null ]
then
echo "Error: Got empty token"
exit 1
fi
echo "ACCESS_TOKEN=$access_token" >> $GITHUB_ENV
- name: Upload
uses: ./.github/actions/upload
with:
SEMANTIC_HUB_URL: ${{ secrets[format('SEMANTIC_HUB_{0}_BASE', env.WORKSPACE_UPPERCASE)] }}
TOKEN: ${{ env.ACCESS_TOKEN }}