-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (73 loc) · 2.18 KB
/
rust.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
on:
workflow_dispatch:
inputs:
rust_version:
description: "Version of Rust to recompress."
type: string
required: true
github_tag:
description: "Tag to upload the release to."
type: string
required: true
env:
XZ_OPT: "-T0"
name: Rust
jobs:
recompress_rust:
name: Recompress Rust
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
target: [
"x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
]
component: [
"rustc",
"rust-std",
"cargo",
"clippy",
"rustfmt",
"llvm-tools",
"rustc-dev"
]
steps:
- name: Download Rust Components
run: |
mkdir downloads
mkdir artifacts
component=${{ matrix.component }}
target=${{ matrix.target }}
version=${{ inputs.rust_version }}
cd downloads
if [[ $version =~ ^(nightly|beta) ]]; then
IFS='/' read -r channel date <<< "$version"
export full_name="$component-$channel-$target"
export url_prefix=https://static.rust-lang.org/dist/$date
else
echo "STABLE"
export full_name="$component-$version-$target"
export url_prefix=https://static.rust-lang.org/dist
fi
xz_name="$full_name.tar.xz"
wget "$url_prefix/$xz_name"
tar -xJf $xz_name
tar -cf - $full_name | zstd --ultra -22 -o "../artifacts/$full_name.tar.zst"
- name: Determine Release Tag
run: |
RELEASE_TAG="rust-${{ inputs.rust_version }}"
if [ -n "${{ inputs.github_tag }}" ]; then
RELEASE_TAG="${{ inputs.github_tag }}"
fi
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
- name: Upload zstd Compressed Artifacts to Release
uses: svenstaro/upload-release-action@v2
with:
file: "artifacts/*.tar.zst"
file_glob: true
tag: ${{ env.RELEASE_TAG }}
overwrite: true