-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate website push to LRZ GItLab (#12)
* 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
1 parent
7f2eb94
commit a839ccf
Showing
1 changed file
with
48 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||