Tiny Agents - Version and Release #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tiny Agents - Version and Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| newversion: | |
| type: choice | |
| description: "Semantic Version Bump Type" | |
| default: patch | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| bypass_deps_check: | |
| type: boolean | |
| description: "Bypass dependency checking" | |
| default: false | |
| concurrency: | |
| group: "push-to-main" # Consider changing this if tiny-agents has its own release concurrency group | |
| defaults: | |
| run: | |
| working-directory: packages/tiny-agents | |
| jobs: | |
| version_and_release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.BOT_ACCESS_TOKEN }} | |
| - run: npm install -g corepack@latest && corepack enable | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20" | |
| cache: "pnpm" | |
| cache-dependency-path: | | |
| packages/tiny-agents/pnpm-lock.yaml | |
| packages/doc-internal/pnpm-lock.yaml | |
| registry-url: "https://registry.npmjs.org" | |
| - run: pnpm install | |
| - run: git config --global user.name machineuser | |
| - run: git config --global user.email [email protected] | |
| - run: | | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| BUMPED_VERSION=$(node -p "require('semver').inc('$PACKAGE_VERSION', '${{ github.event.inputs.newversion }}')") | |
| # Update package.json with the new version | |
| node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./package.json')); package.version = '$BUMPED_VERSION'; fs.writeFileSync('./package.json', JSON.stringify(package, null, '\t') + '\n');" | |
| pnpm --filter doc-internal run fix-cdn-versions | |
| git add ../.. | |
| git commit -m "🔖 @huggingface/tiny-agents $BUMPED_VERSION" | |
| git tag "tiny-agents-v$BUMPED_VERSION" | |
| # Add checks for dependencies if needed, similar to hub-publish.yml | |
| - if: ${{ !github.event.inputs.bypass_deps_check }} | |
| name: "Check Deps are published before publishing this package" | |
| run: pnpm -w check-deps inference && pnpm -w check-deps tasks # Review if these specific deps apply to tiny-agents | |
| - run: pnpm publish --no-git-checks . | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - run: (git pull --rebase && git push --follow-tags) || (git pull --rebase && git push --follow-tags) | |
| # hack - reuse actions/setup-node@v3 just to set a new registry | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://npm.pkg.github.com" | |
| # Disable for now, until github supports PATs for writing github packages (https://github.com/github/roadmap/issues/558) | |
| # - run: pnpm publish --no-git-checks . | |
| # env: | |
| # NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Update Doc" | |
| uses: peter-evans/repository-dispatch@v2 | |
| with: | |
| event-type: doc-build | |
| token: ${{ secrets.BOT_ACCESS_TOKEN }} |