Skip to content

docs: fact-check and fix documentation against actual codebase #88

docs: fact-check and fix documentation against actual codebase

docs: fact-check and fix documentation against actual codebase #88

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
env:
VERSION: '0.0.0'
permissions:
contents: write
packages: write
id-token: write
steps:
# =================================================================
# 1. SETUP
# =================================================================
- name: Checkout code
uses: actions/checkout@v4
- name: Initialize VERSION
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
else
echo "VERSION=0.0.0" >> $GITHUB_ENV
fi
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }}
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Node.js and pnpm
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
# =================================================================
# 2. BUILD & TEST
# =================================================================
- name: Build and test all packages
run: ./scripts/build-all.sh ${{ env.VERSION }}
# =================================================================
# 3. DEPLOY (only on tag push)
# =================================================================
- name: '[Java] Deploy to Maven Central'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: mvn -B -pl opendataloader-pdf-core deploy -P release
working-directory: ./java
env:
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: '[Python] Publish to PyPI'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./python/opendataloader-pdf/dist
- name: '[Node.js] Publish to npm'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: pnpm publish --no-git-checks
working-directory: ./node/opendataloader-pdf
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# =================================================================
# 4. GITHUB & DOCKER RELEASE (only on tag push)
# =================================================================
- name: Log in to GitHub Container Registry
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push CLI Docker image
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v5
with:
context: ./java/opendataloader-pdf-cli
file: ./java/opendataloader-pdf-cli/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/opendataloader-pdf-cli:${{ env.VERSION }}
ghcr.io/${{ github.repository_owner }}/opendataloader-pdf-cli:latest
- name: Wait for PyPI package availability
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
for i in $(seq 1 12); do
pip index versions opendataloader-pdf 2>/dev/null | grep -q "${{ env.VERSION }}" && exit 0
echo "Waiting for PyPI propagation... ($i/12)"; sleep 15
done
echo "WARNING: PyPI propagation timed out, proceeding anyway"
- name: Build and push Hybrid Server Docker image (CPU)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v5
with:
context: ./python/opendataloader-pdf
file: ./python/opendataloader-pdf/Dockerfile.hybrid
push: true
build-args: VERSION=${{ env.VERSION }}
tags: |
ghcr.io/${{ github.repository_owner }}/opendataloader-pdf-hybrid:${{ env.VERSION }}
ghcr.io/${{ github.repository_owner }}/opendataloader-pdf-hybrid:latest
- name: Build and push Hybrid Server Docker image (GPU)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v5
with:
context: ./python/opendataloader-pdf
file: ./python/opendataloader-pdf/Dockerfile.hybrid-gpu
push: true
build-args: VERSION=${{ env.VERSION }}
tags: |
ghcr.io/${{ github.repository_owner }}/opendataloader-pdf-hybrid:${{ env.VERSION }}-gpu
ghcr.io/${{ github.repository_owner }}/opendataloader-pdf-hybrid:latest-gpu
- name: Package CLI as ZIP
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
run: |
cd java/opendataloader-pdf-cli/target
mkdir -p release
cp "opendataloader-pdf-cli-${{ env.VERSION }}.jar" release/
cp ../../../README.md release/
cd release
zip "../opendataloader-pdf-cli-${{ env.VERSION }}.zip" *
cd ../..
- name: Create GitHub Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
generate_release_notes: true
files: |
java/opendataloader-pdf-cli/target/opendataloader-pdf-cli-${{ env.VERSION }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# =================================================================
# 5. SYNC DOCS TO HOMEPAGE (only on tag push)
# =================================================================
- name: Sync docs to homepage repo
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# Pinned to v1.7.3 for security - verify before updating
uses: cpina/github-action-push-to-another-repository@55306faa4ed53b815ae49e564af8cfb359d32ae2 # v1.7.3
with:
source-directory: 'content/docs'
destination-github-username: 'opendataloader-project'
destination-repository-name: 'opendataloader.org'
target-directory: 'apps/v1/content/docs'
target-branch: main
env:
API_TOKEN_GITHUB: ${{ secrets.HOMEPAGE_SYNC_TOKEN }}