Update deploy_to_private.yaml #24
This file contains hidden or 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: Deploy to Open Repo | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| if: | | |
| github.event.repository.name == 'staging_open' && | |
| github.event.pusher.name != 'github-actions[bot]' | |
| name: Push built output to target repo via SSH | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository (no persisted credentials) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: deploy | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Start ssh-agent and add deploy key | |
| uses: webfactory/ssh-agent@v0.9.1 | |
| with: | |
| ssh-private-key: ${{ secrets.DEPLOY }} | |
| - name: Configure git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/Sllambias/staging_open | |
| git remote add ssh-origin git@github.com:Sllambias/staging_private.git | |
| - name: Ensure github.com is in known_hosts | |
| run: | | |
| mkdir -p ~/.ssh | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| chmod 644 ~/.ssh/known_hosts | |
| - name: Update deployment with secondary main | |
| run: | | |
| git fetch ssh-origin main | |
| git rebase -X ours ssh-origin/deploy | |
| git merge --squash -X theirs origin/main --allow-unrelated-histories | |
| - name: Update deployment branch with local main | |
| run: | | |
| git restore --staged README.md | |
| - name: tttt | |
| run: | | |
| echo $(git status) | |
| echo $(git diff) | |
| - name: qqqq | |
| run: | | |
| git commit -m "deploy changes" | |
| - name: commit | |
| run: | | |
| git push -f -u origin deploy | |
| - name: Sync repositories | |
| run: | | |
| echo "Pushing to SSH remote: git@github.com:Sllambias/staging_private.git -> branch main" | |
| git remote -v | |
| echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" | |
| ssh -T -o StrictHostKeyChecking=no git@github.com || true | |
| - name: Sync repositoriesv2 | |
| run: | | |
| git push -u ssh-origin HEAD:main |