fix(ci): use secret for SSH key instead of container volume
Some checks failed
CI/CD / Test (push) Successful in 30s
CI/CD / Lint (push) Successful in 38s
CI/CD / Generate SBOM (push) Successful in 15s
CI/CD / Build (darwin-amd64) (push) Successful in 21s
CI/CD / Build (linux-amd64) (push) Successful in 22s
CI/CD / Build (darwin-arm64) (push) Successful in 22s
CI/CD / Build (linux-arm64) (push) Successful in 21s
CI/CD / Build & Push Docker Image (push) Successful in 21s
CI/CD / Mirror to GitHub (push) Failing after 26s
CI/CD / Release (push) Has been skipped
Some checks failed
CI/CD / Test (push) Successful in 30s
CI/CD / Lint (push) Successful in 38s
CI/CD / Generate SBOM (push) Successful in 15s
CI/CD / Build (darwin-amd64) (push) Successful in 21s
CI/CD / Build (linux-amd64) (push) Successful in 22s
CI/CD / Build (darwin-arm64) (push) Successful in 22s
CI/CD / Build (linux-arm64) (push) Successful in 21s
CI/CD / Build & Push Docker Image (push) Successful in 21s
CI/CD / Mirror to GitHub (push) Failing after 26s
CI/CD / Release (push) Has been skipped
This commit is contained in:
@@ -199,24 +199,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [test, lint]
|
needs: [test, lint]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.MIRROR_ENABLED != 'false'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.MIRROR_ENABLED != 'false'
|
||||||
container:
|
|
||||||
image: debian:bookworm-slim
|
|
||||||
volumes:
|
|
||||||
- /root/.ssh:/root/.ssh:ro
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install git
|
|
||||||
run: apt-get update && apt-get install -y --no-install-recommends git openssh-client ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
- name: Setup SSH key
|
- name: Setup SSH key
|
||||||
run: |
|
run: |
|
||||||
chmod 600 /root/.ssh/id_ed25519 2>/dev/null || true
|
mkdir -p ~/.ssh
|
||||||
ssh-keyscan github.com >> /root/.ssh/known_hosts
|
echo "${{ secrets.GITHUB_MIRROR_SSH_KEY }}" > ~/.ssh/id_ed25519
|
||||||
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Clone and mirror
|
- name: Clone and mirror
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
||||||
git clone --mirror ${{ env.GITEA_URL }}/${GITHUB_REPOSITORY}.git repo.git
|
git clone --mirror ${{ env.GITEA_URL }}/${GITHUB_REPOSITORY}.git repo.git
|
||||||
cd repo.git
|
cd repo.git
|
||||||
git remote add github git@github.com:PlusOne/hmac-file-server.git
|
git remote add github git@github.com:PlusOne/hmac-file-server.git
|
||||||
git push --mirror github || git push --force --all github && git push --force --tags github
|
git push --mirror github || (git push --force --all github && git push --force --tags github)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user