Skip to content

Commit f02f8f3

Browse files
committed
Move ssh-agent clean up to the deploy script
1 parent 51782b1 commit f02f8f3

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

.github/deploy.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
#
33
# Deploy artifacts (e.g. dmg, deb files) built by CI to downloads.mixxx.org.
44

5-
set -eu -o pipefail
5+
set -Eeuo pipefail
66

77
[ -z "${SSH_HOST}" ] && echo "Please set the SSH_HOST env var." >&2 && exit 1
88
[ -z "${SSH_KEY}" ] && echo "Please set the SSH_KEY env var." >&2 && exit 1
@@ -17,13 +17,17 @@ GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
1717
DEST_PATH="${DESTDIR}/${GIT_BRANCH}/${OS}"
1818
TMP_PATH="${DESTDIR}/.tmp/${UPLOAD_ID}"
1919

20-
echo "Deploying to $TMP_PATH, then to $DEST_PATH."
20+
echo "Deploying to ${TMP_PATH}, then to ${DEST_PATH}."
2121

22-
# Start SSH agent
23-
ssh-agent -a ${SSH_AUTH_SOCK} > /dev/null
22+
eval "$(ssh-agent -s)" >/dev/null
23+
24+
cleanup() {
25+
eval "$(ssh-agent -k)" >/dev/null
26+
}
27+
trap cleanup EXIT
2428

2529
# Add private key to SSH agent
26-
ssh-add - <<< "${SSH_KEY}"
30+
ssh-add - <<< "${SSH_KEY}" >/dev/null
2731

2832
# realpath does not exist on macOS
2933
command -v realpath >/dev/null 2>&1 || realpath() {

.github/workflows/build.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,15 @@ jobs:
209209
# Use retry loop to work around intermittent transfer issue
210210
uses: nick-fields/retry@9417ab499314dfe692edb043ded2ff9b3f5f0a68 # v3
211211
with:
212-
shell: bash
213212
max_attempts: 10
214213
timeout_minutes: 20
215214
retry_wait_seconds: 5
216215
command: |
217216
cd ${{ matrix.vcpkg_path }}
218217
.github/deploy.sh ${{ env.DEPS_BASE_NAME }}-${{ env.MIXXX_VERSION }}-${{ matrix.deps_name }}-${{ steps.vars.outputs.sha_short }}.zip
219-
on_retry_command: |
220-
if [[ "$RUNNER_OS" == "Windows" ]]; then
221-
powershell -Command "Get-Process ssh-agent -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue"
222-
else
223-
killall ssh-agent || true
224-
fi
225218
env:
226219
DESTDIR: public_html/downloads/dependencies
227220
OS: ${{ runner.os }}
228-
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
229221
SSH_HOST: downloads-hostgator.mixxx.org
230222
SSH_KEY: ${{ secrets.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY }}
231223
SSH_PASSWORD: ${{ secrets.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY_PASSWORD }}

0 commit comments

Comments
 (0)