8000 Consolidate Coder download and login steps · coder/setup-action@097c26b · GitHub
[go: up one dir, main page]

Skip to content

Commit 097c26b

Browse files
committed
Consolidate Coder download and login steps
1 parent 4277773 commit 097c26b

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

action.yaml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,44 @@ inputs:
1717
runs:
1818
using: "composite"
1919
steps:
20-
- name: Download Coder binary from access URL (Windows)
20+
- name: Download and install Coder binary (Windows)
2121
if: runner.os == 'Windows'
2222
run: |
23-
curl -fsSL ${{ inputs.access_url }}/bin/coder-windows-amd64.exe -o $env:USERPROFILE\AppData\Local\bin\coder.exe
23+
if (${{ runner.arch }} -eq "ARM64") {
24+
$ARCH = "arm64"
25+
} else {
26+
$ARCH = "amd64"
27+
}
28+
curl -fsSL ${{ inputs.access_url }}/bin/coder-windows-$ARCH.exe -o $env:USERPROFILE\AppData\Local\bin\coder.exe
2429
echo "$env:USERPROFILE\AppData\Local\bin" >> $GITHUB_PATH
2530
shell: pwsh
2631

27-
- name: Download Coder binary from access URL (Linux)
28-
if: runner.os == 'Linux'
32+
- name: Download and install Coder binary (Linux/macOS)
33+
if: runner.os != 'Windows'
2934
run: |
30-
if [[ "$RUNNER_ARCH" == "ARM64" ]]; then
35+
if [ "${{ runner.arch }}" == "ARM64" ]; then
3136
ARCH="arm64"
3237
else
3338
ARCH="amd64"
3439
fi
35-
curl -fsSL ${{ inputs.access_url }}/bin/coder-linux-$ARCH -o $HOME/.local/bin/coder
40+
OS=${{ runner.os | toLower }}
41+
curl -fsSL ${{ inputs.access_url }}/bin/coder-${OS}-${ARCH} -o $HOME/.local/bin/coder
3642
chmod +x $HOME/.local/bin/coder
3743
echo "$HOME/.local/bin" >> $GITHUB_PATH
3844
shell: bash
3945

40-
- name: Download Coder binary from access URL (macOS)
41-
if: runner.os == 'macOS'
42-
run: |
43-
if [[ "$RUNNER_ARCH" == "ARM64" ]]; then
44-
ARCH="arm64"
45-
else
46-
ARCH="amd64"
47-
fi
48-
curl -fsSL ${{ inputs.access_url }}/bin/coder-darwin-$ARCH -o $HOME/.local/bin/coder
49-
chmod +x $HOME/.local/bin/coder
50-
shell: bash
46+
- name: Login to Coder (Windows)
47+
if: runner.os == 'Windows'
48+
run: coder login --token $CODER_SESSION_TOKEN $CODER_URL
49+
shell: pwsh
50+
env:
51+
CODER_URL: ${{ inputs.access_url }}
52+
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}
5153

52-
- name: Login to Coder
53-
shell: bash
54+
- name: Login to Coder (Linux/macOS)
55+
if: runner.os != 'Windows'
5456
run: coder login --token $CODER_SESSION_TOKEN $CODER_URL
57+
shell: bash
5558
env:
5659
CODER_URL: ${{ inputs.access_url }}
57-
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}
60+
CODER_SESSION_TOKEN: ${{ inputs.coder_session_token }}

0 commit comments

Comments
 (0)
0