Skip to content

Commit fee9c54

Browse files
authored
build: package releases for linux arm64 architecture (#539)
1 parent fe2457c commit fee9c54

8 files changed

Lines changed: 93 additions & 14 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ workflows:
448448
<<: *filters-tag-triggered-workflow-job
449449
name: upload-to-s3-for-install-linux-feature-build
450450
s3-target-path: slack-cli
451-
file-name: "slack_cli_*feature_linux_64-bit.tar.gz"
451+
file-name: "slack_cli_*feature_linux_*.tar.gz"
452452
requires:
453453
- create-github-release-and-artifacts
454454
context: slack-cli-release

.goreleaser.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ builds:
3232
- windows
3333
goarch:
3434
- amd64
35+
- arm64
36+
ignore:
37+
- goos: windows
38+
goarch: arm64
3539

3640
- id: slack-macos
3741
binary: bin/slack
@@ -74,6 +78,8 @@ archives:
7478
{{- .Env.BUILD_VERSION }}_
7579
{{- if eq .Os "darwin" -}}
7680
macOS_{{ if eq .Arch "all" }}64-bit{{ else }}{{ .Arch }}{{ end }}
81+
{{- else if eq .Os "linux" -}}
82+
linux_{{ .Arch }}
7783
{{- else -}}
7884
{{ .Os }}_{{ if eq .Arch "amd64" }}64-bit{{ else }}{{ .Arch }}{{ end }}
7985
{{- end }}

internal/update/cli_autoupdate.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,14 @@ func getUpdateFileName(version, operatingSys, architecture string) (filename str
263263
filename = fmt.Sprintf("slack_cli_%s_macOS_64-bit.zip", version)
264264
}
265265
case "linux":
266-
filename = fmt.Sprintf("slack_cli_%s_linux_64-bit.tar.gz", version)
266+
switch architecture {
267+
case "amd64":
268+
filename = fmt.Sprintf("slack_cli_%s_linux_amd64.tar.gz", version)
269+
case "arm64":
270+
filename = fmt.Sprintf("slack_cli_%s_linux_arm64.tar.gz", version)
271+
default:
272+
filename = fmt.Sprintf("slack_cli_%s_linux_64-bit.tar.gz", version)
273+
}
267274
case "windows":
268275
filename = fmt.Sprintf("slack_cli_%s_windows_64-bit.zip", version)
269276
default:

internal/update/cli_autoupdate_test.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,31 @@ func Test_CLI_getUpdateFileName(t *testing.T) {
6868
version: "3.4.5",
6969
operatingSystem: "linux",
7070
architecture: "amd64",
71-
expectedFilename: "slack_cli_3.4.5_linux_64-bit.tar.gz",
71+
expectedFilename: "slack_cli_3.4.5_linux_amd64.tar.gz",
7272
},
7373
"linux development x86_64": {
7474
version: "3.4.5-6-badaabad",
7575
operatingSystem: "linux",
7676
architecture: "amd64",
77-
expectedFilename: "slack_cli_3.4.5-6-badaabad_linux_64-bit.tar.gz",
77+
expectedFilename: "slack_cli_3.4.5-6-badaabad_linux_amd64.tar.gz",
78+
},
79+
"linux production arm64": {
80+
version: "3.4.5",
81+
operatingSystem: "linux",
82+
architecture: "arm64",
83+
expectedFilename: "slack_cli_3.4.5_linux_arm64.tar.gz",
84+
},
85+
"linux development arm64": {
86+
version: "3.4.5-6-badaabad",
87+
operatingSystem: "linux",
88+
architecture: "arm64",
89+
expectedFilename: "slack_cli_3.4.5-6-badaabad_linux_arm64.tar.gz",
90+
},
91+
"linux production unknown arch fallback": {
92+
version: "3.4.5",
93+
operatingSystem: "linux",
94+
architecture: "riscv64",
95+
expectedFilename: "slack_cli_3.4.5_linux_64-bit.tar.gz",
7896
},
7997
"windows production x86_64": {
8098
version: "3.4.5",

scripts/archive-test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,14 @@ main() {
5959

6060
echo "Checking Linux archives"
6161
check_tar "$DIST_DIR/slack_cli_${VERSION}_linux_64-bit.tar.gz"
62+
check_tar "$DIST_DIR/slack_cli_${VERSION}_linux_amd64.tar.gz"
63+
check_tar "$DIST_DIR/slack_cli_${VERSION}_linux_arm64.tar.gz"
6264
check_tar "$DIST_DIR/slack_cli_dev_linux_64-bit.tar.gz"
65+
check_tar "$DIST_DIR/slack_cli_dev_linux_amd64.tar.gz"
66+
check_tar "$DIST_DIR/slack_cli_dev_linux_arm64.tar.gz"
6367
check_tar "$DIST_DIR/slack_cli_latest_linux_64-bit.tar.gz"
68+
check_tar "$DIST_DIR/slack_cli_latest_linux_amd64.tar.gz"
69+
check_tar "$DIST_DIR/slack_cli_latest_linux_arm64.tar.gz"
6470

6571
echo "Checking Windows archives"
6672
check_exe "$DIST_DIR/slack_cli_${VERSION}_windows_64-bit.zip"

scripts/archive.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,30 @@ main() {
8181

8282
echo "Creating Linux archives"
8383

84-
linux_targz_file_path_version="$DIST_DIR/slack_cli_${VERSION}_linux_64-bit.tar.gz"
85-
linux_targz_file_path_dev="$DIST_DIR/slack_cli_dev_linux_64-bit.tar.gz"
86-
linux_targz_file_path_latest="$DIST_DIR/slack_cli_latest_linux_64-bit.tar.gz"
87-
88-
echo "-> Creating Linux development tar.gz file"
89-
cp "$linux_targz_file_path_version" "$linux_targz_file_path_dev"
84+
linux_targz_file_path_version_64bit="$DIST_DIR/slack_cli_${VERSION}_linux_64-bit.tar.gz"
85+
linux_targz_file_path_version_amd64="$DIST_DIR/slack_cli_${VERSION}_linux_amd64.tar.gz"
86+
linux_targz_file_path_version_arm64="$DIST_DIR/slack_cli_${VERSION}_linux_arm64.tar.gz"
87+
linux_targz_file_path_dev_64bit="$DIST_DIR/slack_cli_dev_linux_64-bit.tar.gz"
88+
linux_targz_file_path_dev_amd64="$DIST_DIR/slack_cli_dev_linux_amd64.tar.gz"
89+
linux_targz_file_path_dev_arm64="$DIST_DIR/slack_cli_dev_linux_arm64.tar.gz"
90+
linux_targz_file_path_latest_64bit="$DIST_DIR/slack_cli_latest_linux_64-bit.tar.gz"
91+
linux_targz_file_path_latest_amd64="$DIST_DIR/slack_cli_latest_linux_amd64.tar.gz"
92+
linux_targz_file_path_latest_arm64="$DIST_DIR/slack_cli_latest_linux_arm64.tar.gz"
93+
94+
echo "-> Creating Linux fallback tar.gz files"
95+
cp "$linux_targz_file_path_version_amd64" "$linux_targz_file_path_version_64bit"
96+
ls -l "$DIST_DIR"/*_"$VERSION"_linux*
97+
98+
echo "-> Creating Linux development tar.gz files"
99+
cp "$linux_targz_file_path_version_amd64" "$linux_targz_file_path_dev_64bit"
100+
cp "$linux_targz_file_path_version_amd64" "$linux_targz_file_path_dev_amd64"
101+
cp "$linux_targz_file_path_version_arm64" "$linux_targz_file_path_dev_arm64"
90102
ls -l "$DIST_DIR"/*dev_linux*
91103

92-
echo "-> Creating Linux production tar.gz file"
93-
cp "$linux_targz_file_path_version" "$linux_targz_file_path_latest"
104+
echo "-> Creating Linux latest tar.gz files"
105+
cp "$linux_targz_file_path_version_amd64" "$linux_targz_file_path_latest_64bit"
106+
cp "$linux_targz_file_path_version_amd64" "$linux_targz_file_path_latest_amd64"
107+
cp "$linux_targz_file_path_version_arm64" "$linux_targz_file_path_latest_arm64"
94108
ls -l "$DIST_DIR"/*latest_linux*
95109

96110
echo "Creating Windows archives"

scripts/install-dev.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,21 @@ install_slack_cli() {
144144
esac
145145
fi
146146
elif [ "$(expr substr "$(uname -s)" 1 5)" == "Linux" ]; then
147-
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_linux_64-bit.tar.gz"
147+
if version_lt "$SLACK_CLI_DEV_VERSION" "4.2.0"; then
148+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_linux_64-bit.tar.gz"
149+
else
150+
case "$(uname -m)" in
151+
x86_64)
152+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_linux_amd64.tar.gz"
153+
;;
154+
aarch64 | arm64)
155+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_linux_arm64.tar.gz"
156+
;;
157+
*)
158+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_linux_64-bit.tar.gz"
159+
;;
160+
esac
161+
fi
148162
else
149163
echo "🛑 Error: This installer is only supported on Linux and macOS"
150164
echo "🔖 Try using a different installation method:"

scripts/install.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,21 @@ install_slack_cli() {
146146
esac
147147
fi
148148
elif [ "$(expr substr "$(uname -s)" 1 5)" == "Linux" ]; then
149-
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_VERSION}_linux_64-bit.tar.gz"
149+
if version_lt "$SLACK_CLI_VERSION" "4.2.0"; then
150+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_VERSION}_linux_64-bit.tar.gz"
151+
else
152+
case "$(uname -m)" in
153+
x86_64)
154+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_VERSION}_linux_amd64.tar.gz"
155+
;;
156+
aarch64 | arm64)
157+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_VERSION}_linux_arm64.tar.gz"
158+
;;
159+
*)
160+
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_VERSION}_linux_64-bit.tar.gz"
161+
;;
162+
esac
163+
fi
150164
else
151165
echo "🛑 Error: This installer is only supported on Linux and macOS"
152166
echo "🔖 Try using a different installation method:"

0 commit comments

Comments
 (0)