name: release-ingest-api on: push: tags: - 'ingest-api/v*' jobs: release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Extract version from tag id: meta shell: bash run: | set -euo pipefail TAG="${GITHUB_REF_NAME}" VERSION="${TAG#ingest-api/v}" echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" - name: Build Docker image (root context) shell: bash run: | set -euo pipefail docker build \ --file apps/ingest-api/Dockerfile \ --tag ingest-api:${{ steps.meta.outputs.version }} \ . - name: Package tar + filtered env id: bundle shell: bash run: | set -euo pipefail VERSION="${{ steps.meta.outputs.version }}" OUT_DIR="dist/release" TAR_PATH="${OUT_DIR}/ingest-api-${VERSION}.tar" ZIP_PATH="${OUT_DIR}/ingest-api-${VERSION}.zip" ENV_PATH="${OUT_DIR}/.env" mkdir -p "${OUT_DIR}" docker save --output "${TAR_PATH}" "ingest-api:${VERSION}" if [ ! -f .env.production ]; then echo ".env.production is missing at repository root" >&2 exit 1 fi # Keep only variables needed by ingest-api deployment. grep -E '^(NODE_ENV|INGEST_|DATABASE_URL|MONGO_URL|REDIS_URL)=' .env.production > "${ENV_PATH}" zip -j "${ZIP_PATH}" "${TAR_PATH}" "${ENV_PATH}" echo "zip_path=${ZIP_PATH}" >> "${GITHUB_OUTPUT}" - name: Create Gitea release with artifact uses: https://gitea.com/actions/gitea-release-action@v1 with: token: ${{ secrets.RELEASE_TOKEN }} tag_name: ${{ github.ref_name }} name: ingest-api v${{ steps.meta.outputs.version }} body: | Automated release bundle for ingest-api. Includes: - Docker image tar - filtered .env for deploy files: | ${{ steps.bundle.outputs.zip_path }}