Skip to content

Feature/doc ar 2

Feature/doc ar 2 #345

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node
id: node
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Install dependencies
run: yarn install
- name: Run antora
run: |
yarn build
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
name: id_ed25519
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: determine target path
run: |
echo "GITHUB_REF is $GITHUB_REF";
echo "PR number is ${{ github.event.number }}";
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
TARGET_PATH=
else
TARGET_PATH=_branches/pr/${{ github.event.number }}
fi
echo "target_path=/var/www/vhosts/h259503.web136.alfahosting-server.de/html/docs.my-agrirouter.com/$TARGET_PATH" >> $GITHUB_ENV;
echo "target_url=https://docs.my-agrirouter.com/$TARGET_PATH" >> $GITHUB_ENV;
grep target_path $GITHUB_ENV;
grep target_url $GITHUB_ENV;
# very unelegant, but hoster does not support SSH key authentication :-/
- name: Rsync to Webspace
run: |
ssh ${{secrets.SSH_USERNAME}}@${{secrets.SSH_HOSTNAME}} "mkdir -p ${{ env.target_path }}";
rsync -av --exclude _branches --delete build/site/ ${{secrets.SSH_USERNAME}}@${{secrets.SSH_HOSTNAME}}:${{ env.target_path }}
- uses: mshick/add-pr-comment@v1
with:
message: |
The content of this PR can be reviewed at
🌏 ${{ env.target_url }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login:
allow-repeats: false