Merge pull request #1 from wineslab/update-readme #2
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: Mirror to Public Repository | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
mirror: | |
runs-on: ubuntu-latest | |
env: | |
MIRROR_PUSH: ${{ secrets.MIRROR_PUSH }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' # Ensures the entire history is fetched | |
- name: Set up SSH Key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
- name: Conditional Push | |
run: | | |
if [ "${{ env.MIRROR_PUSH }}" == "true" ]; then | |
echo "MIRROR_PUSH is set to true, pushing to public repository..." | |
git remote add public [email protected]:wineslab/dApp-library.git | |
git push public main:main --force | |
else | |
echo "MIRROR_PUSH is not set to true, no action taken." | |
fi |