-
-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (68 loc) · 2.94 KB
/
repack_release_from_tzarc.yaml
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
---
name: Repack release from tzarc/qmk_toolchains
on:
workflow_dispatch:
inputs:
tzarc_release_tag:
description: "Tag of the tzarc/qmk_toolchains release to repack"
required: true
default: "latest"
qmk_release_tag:
description: "Tag of the QMK release to publish as"
required: true
default: "latest"
permissions:
contents: write
jobs:
repack_artifacts:
name: Repack and release toolchains
if: github.repository == 'qmk/qmk_toolchains'
runs-on: ubuntu-latest
steps:
- name: Clone toolchains repo
uses: actions/checkout@v4
- name: Delete tag
run: gh release delete ${{ inputs.qmk_release_tag }} --cleanup-tag || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prerequisites
run: |
sudo apt-get update
sudo apt-get install -y jq curl
- name: Download and repack tzarc/qmk_toolchains release
run: |
curl -fsSL https://github.com/repos/tzarc/qmk_toolchains/releases/tags/${{ inputs.tzarc_release_tag }} > release.json
jq -r '.assets[] | select(.name | contains("qmk_toolchain")) | .browser_download_url' release.json > toolchain_urls.txt
for arch in linuxARM64 linuxX64 macosARM64 macosX64 windowsX64; do
for url in $(grep $arch toolchain_urls.txt); do
echo Downloading ${url}...
curl -fsSLO $url
done
mkdir qmk_toolchains_${arch}
for file in $(ls qmk_toolchain*host_${arch}*.tar.xz); do
echo Extracting ${file}...
tar xf $file -C qmk_toolchains_${arch} --strip-components=1
done
echo Performing cleanup...
rm -rf qmk_toolchains_${arch}/build.log.bz2 qmk_toolchains_${arch}/share/doc/avr-libc*/examples
echo Determining version of gcc...
eval "$(bzcat qmk_toolchains_${arch}/share/*.config.bz2 | grep -E '^CT_GCC_VERSION=')"
echo Found version ${CT_GCC_VERSION}.
echo Packaging qmk_toolchains-gcc${CT_GCC_VERSION}-host_${arch}.tar...
tar cf qmk_toolchains-gcc${CT_GCC_VERSION}-host_${arch}.tar qmk_toolchains_${arch}
echo Compressing qmk_toolchains-gcc${CT_GCC_VERSION}-host_${arch}.tar.xz...
xz -T 0 -z -9 -e qmk_toolchains-gcc${CT_GCC_VERSION}-host_${arch}.tar
echo Showing file metadata of qmk_toolchains-gcc${CT_GCC_VERSION}-host_${arch}.tar.xz...
ls -1al qmk_toolchains-gcc${CT_GCC_VERSION}-host_${arch}.tar.xz
echo Cleaning up...
rm -rf qmk_toolchains_${arch} qmk_toolchain-*
done
- name: Dump list
run: |
ls -1al *.tar.xz
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
qmk_toolchain*
tag_name: ${{ inputs.qmk_release_tag }}