deploy changes #50
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: sync from open | |
| 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 main2 | |
| run: | | |
| git fetch ssh-origin main | |
| git rebase -X ours ssh-origin/main | |
| git merge --squash -X theirs origin/main | |
| - 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: 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 |