name: Daily Release on: schedule: # Run every day at 9:00 UTC - cron: '0 9 * * *' # Allow manual trigger for testing workflow_dispatch: jobs: prepare: runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} last_release: ${{ steps.last-release.outputs.hash }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Find package directories id: set-matrix run: | DIRS=$(git ls-tree -r HEAD --name-only | grep -E "package.json|pyproject.toml" | xargs dirname | grep -v "^.$" | jq -R -s -c 'split("\n")[:-1]') echo "matrix=${DIRS}" >> $GITHUB_OUTPUT - name: Get last release hash id: last-release run: | HASH=$(git rev-list --tags --max-count=1 || echo "HEAD~1") echo "hash=${HASH}" >> $GITHUB_OUTPUT release: needs: prepare runs-on: ubuntu-latest strategy: matrix: directory: ${{ fromJson(needs.prepare.outputs.matrix) }} fail-fast: false permissions: contents: write packages: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: astral-sh/setup-uv@v5 - name: Setup Node.js if: endsWith(matrix.directory, 'package.json') uses: actions/setup-node@v4 with: node-version: '18' registry-url: 'https://registry.npmjs.org' - name: Setup Python if: endsWith(matrix.directory, 'pyproject.toml') run: uv python install - name: Release package env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} run: uv run --script scripts/release.py "${{ matrix.directory }}" "${{ needs.prepare.outputs.last_release }}" >> "$GITHUB_OUTPUT" create-release: needs: [prepare, release] runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 - name: Create Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Check if there's output from release step if [ -s "$GITHUB_OUTPUT" ]; then DATE=$(date +%Y.%m.%d) # Create git tag git tag -s -a -m"automated release v${DATE}" "v${DATE}" git push origin "v${DATE}" # Create release notes echo "# Release ${DATE}" > notes.md echo "" >> notes.md echo "## Updated Packages" >> notes.md # Read updated packages from github output while IFS= read -r line; do echo "- ${line}" >> notes.md done < "$GITHUB_OUTPUT" # Create GitHub release gh release create "v${DATE}" \ --title "Release ${DATE}" \ --notes-file notes.md fi