Skip to content

feat 263 i18n linter checks #845

feat 263 i18n linter checks

feat 263 i18n linter checks #845

Workflow file for this run

name: CI Pipeline
on:
push:
branches:
- dev
- main
pull_request:
env:
DOCKER_TLS_CERTDIR: ""
GIT_SUBMODULE_STRATEGY: recursive
jobs:
build:
runs-on: ubuntu-latest
services:
docker:
image: docker:24.0.7-dind
options: --privileged
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y make nodejs npm
- name: Build project
run: |
make ENV=dev build
docker wait care_dev-docs_sphinx-1
docker compose -p "care_dev" rm -f -s -v
tar -czvf docs.tar.gz ./docs/build
- name: Upload documentation artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs.tar.gz
deploy_docs:
runs-on: ubuntu-latest
needs: build
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && github.event_name == 'push'
permissions:
contents: write
steps:
- name: Download documentation artifact
uses: actions/download-artifact@v4
with:
name: documentation
- name: Extract documentation
run: tar -xzvf docs.tar.gz
- name: Prepare branch docs folder
run: |
mkdir -p publish/${{ github.ref_name }}
cp -r docs/build/html/. publish/${{ github.ref_name }}/
cat > publish/index.html <<'EOF'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=./main/">
<title>Redirecting to CARE documentation</title>
<script>
window.location.replace("./main/");
</script>
</head>
<body>
<p>Redirecting to <a href="./main/">main documentation</a>...</p>
</body>
</html>
EOF
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./publish
keep_files: true
audit:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: |
npm ci --prefix frontend --ignore-scripts
npm ci --prefix backend --ignore-scripts
npm ci --prefix utils/modules/editor-delta-conversion --ignore-scripts
npm ci --prefix utils/modules/assessment-score --ignore-scripts
- name: Run npm audit
run: make audit
lint:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install frontend dependencies
run: npm ci --prefix frontend --ignore-scripts
- name: Run linter
run: make lint
sync_to_gitlab:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to GitLab via HTTPS
env:
GITLAB_USER: ${{ secrets.GITLAB_USER }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
BRANCH: ${{ github.ref_name }}
run: |
set -euo pipefail
# Strip any whitespace/newlines from credentials
GITLAB_USER_CLEAN=$(echo "$GITLAB_USER" | tr -d '[:space:]')
GITLAB_TOKEN_CLEAN=$(echo "$GITLAB_TOKEN" | tr -d '[:space:]')
# Remove existing remote to avoid "remote already exists" errors
git remote remove gitlab || true
# Add remote - URL is quoted to avoid shell word-splitting when token contains special chars
git remote add gitlab "https://${GITLAB_USER_CLEAN}:${GITLAB_TOKEN_CLEAN}@git.ukp.informatik.tu-darmstadt.de/zyska/care.git"
# Push current HEAD to the target branch on GitLab, explicitly using HEAD:BRANCH
# Quote $BRANCH to avoid word-splitting
git push --set-upstream gitlab "HEAD:${BRANCH}"