Align Gitea workflow checkout with existing deploy
Build and Deploy / build-and-deploy (push) Successful in 2m9s
Build and Deploy / build-and-deploy (push) Successful in 2m9s
This commit is contained in:
1 parent
c7e949b074
commit
b27f045796
1 file changed
+4
-16
@@ -21,24 +21,12 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GITEA_SSH_PRIVATE_KEY: ${{ secrets.GITEA_SSH_PRIVATE_KEY }}
|
GITEA_TOKEN: ${{ github.token }}
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
||||||
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
|
||||||
run: |
|
run: |
|
||||||
git init .
|
git init .
|
||||||
checkout_key="${GITEA_SSH_PRIVATE_KEY:-${SSH_PRIVATE_KEY:-${DEPLOY_KEY:-}}}"
|
git remote add origin "https://git.k2patel.in/k2patel/apcupsd-client.git"
|
||||||
if [[ -z "$checkout_key" ]]; then
|
AUTH_HEADER="$(printf 'x-access-token:%s' "$GITEA_TOKEN" | base64 -w 0)"
|
||||||
echo "::error::No global SSH checkout key found. Configure GITEA_SSH_PRIVATE_KEY, SSH_PRIVATE_KEY, or DEPLOY_KEY."
|
git config --local "http.https://git.k2patel.in/.extraheader" "AUTHORIZATION: basic ${AUTH_HEADER}"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
chmod 700 ~/.ssh
|
|
||||||
printf '%s\n' "$checkout_key" > ~/.ssh/id_ed25519
|
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
|
||||||
ssh-keyscan -p 2222 git.k2patel.in >> ~/.ssh/known_hosts
|
|
||||||
chmod 600 ~/.ssh/known_hosts
|
|
||||||
git remote add origin "ssh://git@git.k2patel.in:2222/k2patel/apcupsd-client.git"
|
|
||||||
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes" \
|
|
||||||
git -c protocol.version=2 fetch --no-tags --prune --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
git -c protocol.version=2 fetch --no-tags --prune --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
||||||
git checkout --force refs/remotes/origin/main
|
git checkout --force refs/remotes/origin/main
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user