Update github actions for checkout and setup node to v4 #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync to Open CoDE | |
concurrency: Sync | |
on: | |
push: | |
branches: [main] | |
jobs: | |
to_opencode: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: # <-- must use actions/checkout before mirroring! | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Ensure all branches are available | |
run: | | |
git fetch origin -u '+refs/heads/*:refs/heads/*' --update-head-ok | |
- name: Sync repo to OpenCoDE | |
shell: bash | |
run: | | |
set -x | |
# Create ssh client config | |
mkdir ~/.ssh | |
cat <<EOF > ~/.ssh/config | |
Host $DESTINATION_HOST | |
ServerAliveInterval 60 | |
ServerAliveCountMax 5 | |
KexAlgorithms ecdh-sha2-nistp521 | |
EOF | |
# Add host key | |
ssh-keyscan $DESTINATION_HOST > ~/.ssh/known_hosts | |
# Start ssh-agent and add private key | |
eval $(ssh-agent) | |
echo "$SSH_KEY" | sed '$ s/\n$//' | ssh-add - | |
# List local branches | |
git branch --all | |
# Push | |
git remote add destination git@$DESTINATION_HOST:$DESTINATION_REPO | |
git push destination -f --all --prune | |
git push destination -f --tags | |
env: | |
SSH_KEY: ${{ secrets.OPENCODE_SSH_PRIVATE_KEY }} | |
DESTINATION_HOST: gitlab.opencode.de | |
DESTINATION_REPO: digitalservicebund/digitalservicebund.git |