Skip to content

Commit 01608bf

Browse files
committed
add action to simplify usage in GH workflows
1 parent 6642330 commit 01608bf

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

action.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 'Install Qt'
2+
description: 'Install Qt libraries'
3+
4+
inputs:
5+
qt-version:
6+
description: 'Qt version to install'
7+
required: true
8+
default: '6.8.1-3'
9+
10+
os:
11+
description: 'Operating system, accepts standard GitHub Actions runner names'
12+
required: true
13+
default: 'ubuntu-22.04'
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Show runner OS
19+
shell: bash
20+
run: |
21+
echo "Running on: ${{ runner.name }} - ${{ runner.os }} - ${{ runner.arch }}"
22+
23+
- name: Determine base name
24+
shell: bash
25+
run: |
26+
os=${{ inputs.os }}
27+
echo "base-name=qt-${{ inputs.qt-version }}-${os//[.-]/}" >> $GITHUB_ENV
28+
29+
- name: Download Qt from releases
30+
uses: robinraju/release-downloader@v1
31+
with:
32+
repository: "giallu/qt-lgpl"
33+
tag: ${{ env.base-name }}
34+
fileName: ${{ env.base-name }}.${{ runner.os == 'Windows' && 'zip' || 'tar.xz' }}
35+
36+
- name: Extract Qt and Add Qt to $PATH (Windows)
37+
shell: pwsh
38+
if: runner.os == 'Windows'
39+
run: |
40+
Remove-Item -Recurse C:\Qt -ErrorAction silentlycontinue
41+
Remove-Item -Recurse C:\Qt-${{ inputs.qt-version }} -ErrorAction silentlycontinue
42+
7z x ${{ env.base-name }}.zip -oC:\
43+
mv C:\${{ env.base-name }} C:\Qt-${{ inputs.qt-version }}
44+
Add-Content $env:GITHUB_PATH "C:\Qt-${{ inputs.qt-version }}\bin"
45+
46+
- name: Extract Qt and Add Qt to $PATH (Other OS)
47+
shell: bash
48+
if: runner.os != 'Windows'
49+
run: |
50+
echo "Extracting Qt to ${GITHUB_WORKSPACE}/Qt-${{ inputs.qt-version }}"
51+
rm -rf ${GITHUB_WORKSPACE}/Qt-${{ inputs.qt-version }}
52+
mkdir ${GITHUB_WORKSPACE}/Qt-${{ inputs.qt-version }}
53+
tar xf ${{ env.base-name }}.tar.xz -C${GITHUB_WORKSPACE}/Qt-${{ inputs.qt-version }} --strip-components 1
54+
echo "${GITHUB_WORKSPACE}/Qt-${{ inputs.qt-version }}/bin" >> "$GITHUB_PATH"

0 commit comments

Comments
 (0)