Skip to content

Commit

Permalink
Automate website push to LRZ GItLab (#12)
Browse files Browse the repository at this point in the history
* Use SSH action workflow

* Add SSH connection check

* Add SSH known hosts

* Set up push as separate job and push all branches

* Add the forgotten checkout step

* Force push gh-pages to lrz remote

* Explicitly checkout gh-pages branch and add checks
  • Loading branch information
NeuroShepherd authored Jan 22, 2025
1 parent 7f2eb94 commit a839ccf
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,51 @@ jobs:
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

push-to-lrz-gitlab:
needs: build-deploy
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Add GitLab to known hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan gitlab.lrz.de >> ~/.ssh/known_hosts
# You can also verify the fingerprint manually (optional)
# ssh-keyscan gitlab.lrz.de | tee -a ~/.ssh/known_hosts
- name: Check LRZ connection
run: |
ssh -T [email protected]
- name: Add LRZ GitLab remote
run: |
git remote add lrz_gitlab_remote [email protected]:lmu-open-science-center/lmu-osc-website.git
git remote -v
- name: Fetch and checkout branch
run: |
git status
git branch
git fetch origin gh-pages
git branch
git checkout -b gh-pages origin/gh-pages
git branch
git status
- name: Push gh-pages to LRZ
run: |
# push gh-pages
git push --force lrz_gitlab_remote gh-pages

0 comments on commit a839ccf

Please sign in to comment.