diff options
| -rw-r--r-- | .builds/deploy.yml | 34 | ||||
| -rw-r--r-- | .github/dependabot.yml | 6 | ||||
| -rw-r--r-- | .github/workflows/codeql.yml | 46 | ||||
| -rw-r--r-- | build.py | 11 |
4 files changed, 45 insertions, 52 deletions
diff --git a/.builds/deploy.yml b/.builds/deploy.yml new file mode 100644 index 0000000..62588ae --- /dev/null +++ b/.builds/deploy.yml @@ -0,0 +1,34 @@ +image: debian/bookworm + +packages: + - emacs-nox + - python3 + - python3-pip + - rsync + - openssh-client + +sources: + - https://git.sr.ht/~ccleberg/cleberg.net + +secrets: + - <ssh-deploy-key-uuid> # ~/.ssh/id_rsa, has write access to server + +environment: + ENV: prod + BUILD: "true" + +tasks: + - setup: | + pip install --break-system-packages uv + curl -sSfL https://github.com/tdewolff/minify/releases/latest/download/minify_linux_amd64.tar.gz \ + | tar -xz -C ~/.local/bin minify + - build: | + cd cleberg.net + uv run build.py + - deploy: | + cd cleberg.net + chmod 600 ~/.ssh/id_rsa + rsync -r --delete-before \ + -e "ssh -o StrictHostKeyChecking=no" \ + .build/ \ + homelab:/var/www/cleberg.net/ diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 6483b1d..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "uv" - directory: "/" - schedule: - interval: "weekly" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index f857dda..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: "CodeQL Advanced" - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - analyze: - name: Analyze (${{ matrix.language }}) - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - permissions: - security-events: write - packages: read - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - include: - - language: python - build-mode: none - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Initialize CodeQL - uses: github/codeql-action/init@v4 - with: - languages: ${{ matrix.language }} - build-mode: ${{ matrix.build-mode }} - - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 - with: - category: "/language:${{matrix.language}}" @@ -34,6 +34,16 @@ from datetime import datetime from pathlib import Path +def run_ruff(): + print("Running ruff...") + for cmd in [["ruff", "check", "--fix"], ["ruff", "format"]]: + result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + if result.returncode != 0: + print(f"ruff error ({' '.join(cmd)}):") + print(result.stderr, file=sys.stderr) + sys.exit(1) + + def update_index_html(html_snippet, template_path="./.build/index.html"): """ Read the index.html file at `template_path`, replace everything between @@ -558,6 +568,7 @@ def start_dev_server(build_dir): def main(): + run_ruff() html_snippet = get_recent_posts_html("./content/blog", num_posts=3) build_dir = Path(".build") |
