Merge branch 'main' of https://github.com/dke-data/agrirouter-user-do… #697
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 | |
# 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 | |
on: | |
push: | |
branches: | |
- main | |
- production | |
pull_request: | |
jobs: | |
build: | |
name: Build and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node | |
id: node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
- name: Install po4a dependencies | |
run: sudo apt-get install libyaml-tiny-perl gettext libunicode-linebreak-perl | |
# install po4a (replace by stable tag after v0.66 release / we need PR #331) | |
- name: Install po4a from github | |
run: | | |
git clone --branch v0.66 https://github.com/mquinson/po4a.git ~/po4a | |
ls -la ~/po4a | |
echo "$HOME/po4a" >> $GITHUB_PATH | |
echo "PERLLIB=$HOME/po4a/lib" >> $GITHUB_ENV | |
- name: Update translation files | |
run: po4a --no-translations po4a.conf | |
- name: Commit translation file updates | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: ./i18n/ | |
message: auto-update translation files | |
- name: Install dependencies | |
run: yarn install | |
- name: Run translation | |
run: | | |
echo "PATH=$PATH" | |
echo "PERLLIB=$PERLLIB" | |
yarn translate | |
- 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=_branches/main | |
elif [ "$GITHUB_REF" = "refs/heads/production" ]; then | |
TARGET_PATH= | |
else | |
TARGET_PATH=_branches/pr/${{ github.event.number }} | |
fi | |
echo "target_path=/var/www/vhosts/h259503.web136.alfahosting-server.de/html/manual.my-agrirouter.com/$TARGET_PATH" >> $GITHUB_ENV; | |
echo "target_url=https://manual.agrirouter.com/$TARGET_PATH" >> $GITHUB_ENV; | |
grep target_path $GITHUB_ENV; | |
grep target_url $GITHUB_ENV; | |
- name: Rsync to Webspace | |
run: | | |
ssh ${{secrets.SSH_USERNAME}}@${{secrets.SSH_HOSTNAME}} "mkdir -p ${{ env.target_path }}"; | |
rsync -av --exclude _branches --delete build/ ${{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 |