mirror of
https://github.com/Snigdha-OS/snigdhaos-kernel-switcher-dev.git
synced 2025-09-21 12:44:57 +02:00
41 lines
1.2 KiB
YAML
41 lines
1.2 KiB
YAML
name: Push to GitLab
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master # Adjust the branch as needed
|
|
|
|
jobs:
|
|
sync-to-gitlab:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# Step 1: Checkout the GitHub repository
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
# Step 2: Set up SSH
|
|
- name: Set up SSH for GitLab
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.GITLAB_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
# Ensure the known_hosts file exists and has correct permissions
|
|
touch ~/.ssh/known_hosts
|
|
chmod 644 ~/.ssh/known_hosts
|
|
# Add GitLab's host key to known_hosts
|
|
ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts
|
|
# Verify permissions of the .ssh directory and files
|
|
ls -al ~/.ssh
|
|
|
|
# Step 3: Test SSH Connection (Debugging)
|
|
- name: Test SSH Connection with Verbose Output
|
|
run: |
|
|
ssh -vT git@gitlab.com || exit 1 # Ensure the error code is returned if it fails
|
|
|
|
# Step 4: Push to GitLab
|
|
- name: Push to GitLab
|
|
run: |
|
|
git remote add gitlab git@gitlab.com:Snigdha-OS/snigdhaos-applications/snigdhaos-kernel-switcher-dev.git
|
|
git push --mirror gitlab
|