rework partner process pages (variant: 5 columns) #270
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
name: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# only allow one run per deploy target at once | |
concurrency: | |
group: ${{ github.workflow}}-${{ github.ref }} | |
# cancel previous jobs as we are only interested in the newest | |
cancel-in-progress: true | |
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 }} | |
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/web25462234/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: | | |
sshpass -p ${{secrets.SSH_PASSWORD}} ssh ${{secrets.SSH_USERNAME}}@${{secrets.SSH_HOSTNAME}} "mkdir -p ${{ env.target_path }}"; | |
sshpass -p ${{secrets.SSH_PASSWORD}} 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 |