-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
141 lines (128 loc) · 4.86 KB
/
action.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Download tool4d
description: Download tool4d for the current platform
inputs:
platform:
required: true
type: string
branch:
required: true
type: string
version:
required: true
type: string
build:
required: true
type: string
arch:
required: false
type: string
outputs:
platform:
value: ${{ inputs.platform }}
branch:
value: ${{ inputs.branch }}
version:
value: ${{ inputs.version }}
build:
value: ${{ inputs.build }}
tool4d_download_url:
value: ${{ steps.get.outputs.tool4d_download_url }}
tool4d_executable_path:
value: ${{ steps.get.outputs.tool4d_executable_path }}
runs:
using: "composite"
steps:
- name: check platform windows
if: ${{ startsWith(inputs.platform, 'windows') }}
run: |
chcp 65001
echo ("platform=windows") >> $env:GITHUB_ENV
echo ("TOOL4D_URL="+$env:TOOL4D_URL) >> $env:GITHUB_ENV
shell: pwsh
env:
TOOL4D_URL: https://resources-download.4d.com/release/
- name: check platform macos
if: ${{ startsWith(inputs.platform, 'macos') }}
run: |
echo "platform=macos" >> $GITHUB_ENV
echo "TOOL4D_URL=${TOOL4D_URL}" >> $GITHUB_ENV
shell: bash
env:
TOOL4D_URL: https://resources-download.4d.com/release/
- name: check platform windows
if: ${{ env.platform == 'windows' }}
run: |
chcp 65001
echo ("TOOL4D_PLATFORM=win") >> $env:GITHUB_ENV
echo ("TOOL4D_SUFFIX=") >> $env:GITHUB_ENV
echo ("TOOL4D_EXECUTABLE_PATH=./tool4d/tool4d.exe") >> $env:GITHUB_ENV
shell: pwsh
- name: check platform windows (20.2)
if: ${{ env.platform == 'windows' && inputs.version == '20.2' }}
run: |
chcp 65001
echo ("TOOL4D_DOWNLOAD_URL="+$env:TOOL4D_URL+$env:TOOL4D_BRANCH+"/"+$env:TOOL4D_VERSION+"/"+$env:TOOL4D_BUILD+"/"+$env:TOOL4D_PLATFORM+"/tool4d_v"+$env:TOOL4D_VERSION+"_"+$env:TOOL4D_PLATFORM+$env:TOOL4D_SUFFIX+".tar.xz") >> $env:GITHUB_ENV
shell: pwsh
env:
TOOL4D_BRANCH: ${{ inputs.branch }}
TOOL4D_VERSION: ${{ inputs.version }}
TOOL4D_BUILD: ${{ inputs.build }}
- name: check platform windows
if: ${{ env.platform == 'windows' && inputs.version != '20.2' }}
run: |
chcp 65001 #set code page to utf-8
echo ("TOOL4D_DOWNLOAD_URL="+$env:TOOL4D_URL+$env:TOOL4D_BRANCH+"/"+$env:TOOL4D_VERSION+"/"+$env:TOOL4D_BUILD+"/"+$env:TOOL4D_PLATFORM+"/tool4d_"+$env:TOOL4D_PLATFORM+$env:TOOL4D_SUFFIX+".tar.xz") >> $env:GITHUB_ENV
shell: pwsh
env:
TOOL4D_BRANCH: ${{ inputs.branch }}
TOOL4D_VERSION: ${{ inputs.version }}
TOOL4D_BUILD: ${{ inputs.build }}
- name: check platform macos
if: ${{ (env.platform == 'macos') && (inputs.arch != 'arm') }}
run: |
echo "TOOL4D_PLATFORM=mac" >> $GITHUB_ENV
echo "TOOL4D_SUFFIX=_x86_64" >> $GITHUB_ENV # github macos vm runs on intel
echo "TOOL4D_EXECUTABLE_PATH=tool4d.app/Contents/MacOS/tool4d" >> $GITHUB_ENV
shell: bash
- name: check platform macos
if: ${{ (env.platform == 'macos') && (inputs.arch == 'arm') }}
run: |
echo "TOOL4D_PLATFORM=mac" >> $GITHUB_ENV
echo "TOOL4D_SUFFIX=_arm64" >> $GITHUB_ENV # github macos vm runs on intel
echo "TOOL4D_EXECUTABLE_PATH=tool4d.app/Contents/MacOS/tool4d" >> $GITHUB_ENV
shell: bash
- name: macos (20.2)
if: ${{ env.platform == 'macos' && inputs.version == '20.2' }}
run: |
echo "TOOL4D_DOWNLOAD_URL=${TOOL4D_URL}${TOOL4D_BRANCH}/${TOOL4D_VERSION}/${TOOL4D_BUILD}/${TOOL4D_PLATFORM}/tool4d_${TOOL4D_VERSION}_${TOOL4D_PLATFORM}${TOOL4D_SUFFIX}.tar.xz" >> $GITHUB_ENV
shell: bash
env:
TOOL4D_BRANCH: ${{ inputs.branch }}
TOOL4D_VERSION: ${{ inputs.version }}
TOOL4D_BUILD: ${{ inputs.build }}
- name: macos
if: ${{ env.platform == 'macos' && inputs.version != '20.2' }}
run: |
echo "TOOL4D_DOWNLOAD_URL=${TOOL4D_URL}${TOOL4D_BRANCH}/${TOOL4D_VERSION}/${TOOL4D_BUILD}/${TOOL4D_PLATFORM}/tool4d${TOOL4D_SUFFIX}.tar.xz" >> $GITHUB_ENV
shell: bash
env:
TOOL4D_BRANCH: ${{ inputs.branch }}
TOOL4D_VERSION: ${{ inputs.version }}
TOOL4D_BUILD: ${{ inputs.build }}
- name: download tool4d
if: ${{ env.platform }}
run: |
curl "${TOOL4D_DOWNLOAD_URL}" -o tool4d.tar.xz -sL
tar xJf tool4d.tar.xz
shell: bash
env:
TOOL4D_DOWNLOAD_URL: ${{ env.TOOL4D_DOWNLOAD_URL }}
- id: get
run: |
echo "tool4d_download_url=${TOOL4D_DOWNLOAD_URL}" >> $GITHUB_OUTPUT
echo "tool4d_executable_path=${TOOL4D_EXECUTABLE_PATH}" >> $GITHUB_OUTPUT
shell: bash
- name: ls
run: |
ls .
shell: bash