Skip to content

Commit 5cd5e69

Browse files
committed
chore: use xz compress
1 parent 05240e5 commit 5cd5e69

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ jobs:
8585
- name: Checkout
8686
uses: actions/checkout@v3
8787

88-
- name: 'Clone ${{ matrix.repo }}'
89-
run: 'git clone https://github.com/${{ matrix.repo }} mcm'
88+
- name: Clone ${{ matrix.repo }}
89+
run: git clone https://github.com/${{ matrix.repo }} mcm
9090

9191
- name: Set ${{ matrix.target }} musl with configurations
9292
if: matrix.repo == 'userdocs/qbt-musl-cross-make'
@@ -106,40 +106,40 @@ jobs:
106106
run: cat config.mak
107107
working-directory: mcm
108108

109-
- name: 'Build ${{ matrix.target }}'
109+
- name: Build ${{ matrix.target }}
110110
run: |-
111111
make -j4
112112
make install
113113
ls output
114114
working-directory: mcm
115115

116-
- name: 'Package ${{ matrix.target }}'
116+
- name: Package ${{ matrix.target }}
117117
id: package
118118
run: |-
119-
tar -czvf ../output-${{ matrix.target }}.tar.gz output/
119+
XZ_OPT=-9T0 tar -cvJf ../output-${{ matrix.target }}.tar.xz output/
120120
echo "source_escaped=${REPO%%/*}_${REPO##*/}" >> $GITHUB_OUTPUT
121121
working-directory: mcm
122122

123123
- id: upload-artifacts
124124
name: Upload artifacts
125-
if: '${{ success() }}'
125+
if: ${{ success() }}
126126
uses: cytopia/[email protected]
127127
with:
128-
path: 'output-${{ matrix.target }}.tar.gz'
129-
name: '${{ matrix.target }}-${{ steps.package.outputs.source_escaped }}'
128+
path: output-${{ matrix.target }}.tar.xz
129+
name: ${{ matrix.target }}-${{ steps.package.outputs.source_escaped }}
130130

131131
- name: Rename artifact
132-
run: mv output-${{ matrix.target }}.tar.gz output-${{ matrix.target }}-${{ steps.package.outputs.source_escaped }}.tar.gz
132+
run: mv output-${{ matrix.target }}.tar.xz output-${{ matrix.target }}-${{ steps.package.outputs.source_escaped }}.tar.xz
133133

134134
- id: upload-releases
135135
name: Upload to releases
136136
uses: ncipollo/release-action@v1
137-
if: '${{ github.event.inputs.do_release }}'
137+
if: ${{ github.event.inputs.do_release }}
138138
with:
139139
allowUpdates: true
140-
tag: '${{ github.event.inputs.release }}'
141-
artifacts: 'output-${{ matrix.target }}*.tar.gz'
140+
tag: ${{ github.event.inputs.release }}
141+
artifacts: output-${{ matrix.target }}*.tar.xz
142142
artifactContentType: application/gzip
143143
env:
144-
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145145

index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const tags = {
1919
const url = `https://github.com/nginxui/musl-cross-compilers/releases/download/${tags[variant]}/output-${target}-${variant.replace(
2020
"/",
2121
"_"
22-
)}.tar.gz`;
22+
)}.tar.xz`;
2323

2424
let cachedPath;
2525
if (build) {
@@ -70,14 +70,14 @@ const tags = {
7070
}
7171
cachedPath = destDir;
7272
} else {
73-
cachedPath = tc.find("mcm", `${target}-${variant}.tar.gz`);
73+
cachedPath = tc.find("mcm", `${target}-${variant}.tar.xz`);
7474
}
7575
if (cachedPath) {
7676
console.log(`Found installation at ${cachedPath}`);
7777
} else {
7878
const toolchainPath = await tc.downloadTool(url);
7979
const toolchainExtractedFolder = await tc.extractTar(toolchainPath);
80-
cachedPath = await tc.cacheDir(toolchainExtractedFolder, "mcm", `${target}-${variant}.tar.gz`);
80+
cachedPath = await tc.cacheDir(toolchainExtractedFolder, "mcm", `${target}-${variant}.tar.xz`);
8181
console.log(`Installed at ${cachedPath}`);
8282
}
8383
cachedPath = path.join(cachedPath, "output", "bin");
@@ -87,11 +87,15 @@ const tags = {
8787
} catch (e) {
8888
if (build) {
8989
console.log("Build error occurred and uploading build directory as artifacts");
90-
await exec.exec("tar", ["-czf", "/opt/mcm.tar.gz", buildDir]);
90+
await exec.exec("tar", ["-cJf", "/opt/mcm.tar.xz", buildDir], {
91+
env: {
92+
XZ_OPT: "-9T0"
93+
}
94+
});
9195
const artifact = require("@actions/artifact");
9296
const artifactClient = artifact.create();
9397
const artifactName = `musl-cross-compiler-error-${target}-${variant.replace("/", "_")}`;
94-
const files = ["/opt/mcm.tar.gz"];
98+
const files = ["/opt/mcm.tar.xz"];
9599
const rootDirectory = "/opt/";
96100
const options = {};
97101
await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options);

0 commit comments

Comments
 (0)