ci: run directly on runner using its SSH key
This commit is contained in:
parent
71f752c46e
commit
8b04de80e4
1 changed files with 12 additions and 18 deletions
|
|
@ -8,30 +8,24 @@ on:
|
|||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: golang:1.27
|
||||
|
||||
steps:
|
||||
- name: Install tools
|
||||
- name: Install Go and packaging tools
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y dpkg-dev git curl openssh-client
|
||||
|
||||
- name: Setup SSH
|
||||
env:
|
||||
FORGEJO_SSH_KEY: ${{ secrets.FORGEJO_SSH_KEY }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
printf '%s\n' "${FORGEJO_SSH_KEY}" > ~/.ssh/forgejo_runner
|
||||
chmod 600 ~/.ssh/forgejo_runner
|
||||
# Accept Forgejo SSH host key without prompting.
|
||||
ssh-keyscan -p 554 git-ssh.janvete.com >> ~/.ssh/known_hosts 2>/dev/null || \
|
||||
ssh-keyscan git-ssh.janvete.com >> ~/.ssh/known_hosts 2>/dev/null || true
|
||||
echo "GIT_SSH_COMMAND=ssh -i ~/.ssh/forgejo_runner -o StrictHostKeyChecking=no -o UserKnownHostsFile=~/.ssh/known_hosts" >> "$GITHUB_ENV"
|
||||
# Install Go if not present (works on Debian/Ubuntu runners)
|
||||
if ! command -v go &> /dev/null; then
|
||||
GO_VERSION=1.27.1
|
||||
curl -sL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C /usr/local -xz
|
||||
export PATH="/usr/local/go/bin:${PATH}"
|
||||
echo "PATH=${PATH}" >> "$GITHUB_ENV"
|
||||
fi
|
||||
go version
|
||||
|
||||
- name: Checkout source
|
||||
env:
|
||||
GIT_SSH_COMMAND: ssh -i ~/.ssh/forgejo_runner -o StrictHostKeyChecking=no -o UserKnownHostsFile=~/.ssh/known_hosts
|
||||
GIT_SSH_COMMAND: ssh -i /root/.ssh/forgejo_runner -o StrictHostKeyChecking=no
|
||||
run: |
|
||||
git clone ssh://git@git-ssh.janvete.com:554/seth/Caddyview.git src
|
||||
cd src
|
||||
|
|
@ -126,7 +120,7 @@ jobs:
|
|||
- name: Update Homebrew tap
|
||||
working-directory: src
|
||||
env:
|
||||
GIT_SSH_COMMAND: ssh -i ~/.ssh/forgejo_runner -o StrictHostKeyChecking=no -o UserKnownHostsFile=~/.ssh/known_hosts
|
||||
GIT_SSH_COMMAND: ssh -i /root/.ssh/forgejo_runner -o StrictHostKeyChecking=no
|
||||
run: |
|
||||
VERSION=${{ github.ref_name }}
|
||||
VER=${VERSION#v}
|
||||
|
|
@ -180,7 +174,7 @@ jobs:
|
|||
- name: Update APT repository
|
||||
working-directory: src
|
||||
env:
|
||||
GIT_SSH_COMMAND: ssh -i ~/.ssh/forgejo_runner -o StrictHostKeyChecking=no -o UserKnownHostsFile=~/.ssh/known_hosts
|
||||
GIT_SSH_COMMAND: ssh -i /root/.ssh/forgejo_runner -o StrictHostKeyChecking=no
|
||||
run: |
|
||||
VERSION=${{ github.ref_name }}
|
||||
VER=${VERSION#v}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue