diff --git a/.github/workflows/dduf-publish.yml b/.github/workflows/dduf-publish.yml new file mode 100644 index 000000000..b0a9115a5 --- /dev/null +++ b/.github/workflows/dduf-publish.yml @@ -0,0 +1,74 @@ +name: DDUF - Version and Release + +on: + workflow_dispatch: + inputs: + newversion: + type: choice + description: "Semantic Version Bump Type" + default: patch + options: + - patch + - minor + - major + +concurrency: + group: "push-to-main" + +defaults: + run: + working-directory: packages/dduf + +jobs: + version_and_release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # Needed to push the tag and the commit on the main branch, otherwise we get: + # > Run git push --follow-tags + # remote: error: GH006: Protected branch update failed for refs/heads/main. + # remote: error: Changes must be made through a pull request. Required status check "lint" is expected. + token: ${{ secrets.BOT_ACCESS_TOKEN }} + - run: corepack enable + - uses: actions/setup-node@v3 + with: + node-version: "20" + cache: "pnpm" + cache-dependency-path: | + packages/dduf/pnpm-lock.yaml + # setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED + registry-url: "https://registry.npmjs.org" + - run: pnpm install + - run: git config --global user.name machineuser + - run: git config --global user.email infra+machineuser@huggingface.co + - 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');" + git commit . -m "🔖 @huggingface/dduf $BUMPED_VERSION" + git tag "dduf-v$BUMPED_VERSION" + + + - name: "Check Deps are published before publishing this package" + run: pnpm -w check-deps blob + + - run: pnpm publish --no-git-checks . + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: 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 }} diff --git a/packages/dduf/package.json b/packages/dduf/package.json index 1c25fdfdb..dcb6c8764 100644 --- a/packages/dduf/package.json +++ b/packages/dduf/package.json @@ -19,7 +19,6 @@ "./package.json": "./package.json" }, "browser": { - "./src/utils/FileBlob.ts": false, "./dist/index.js": "./dist/browser/index.js", "./dist/index.mjs": "./dist/browser/index.mjs" }, diff --git a/packages/dduf/pnpm-lock.yaml b/packages/dduf/pnpm-lock.yaml index 3488eb43f..0c7f7196a 100644 --- a/packages/dduf/pnpm-lock.yaml +++ b/packages/dduf/pnpm-lock.yaml @@ -7,7 +7,7 @@ settings: dependencies: '@huggingface/blob': specifier: workspace:^ - version: 'link:' + version: link:../blob devDependencies: '@types/node': diff --git a/packages/dduf/vitest-browser.config.mts b/packages/dduf/vitest-browser.config.mts deleted file mode 100644 index 65be77c7a..000000000 --- a/packages/dduf/vitest-browser.config.mts +++ /dev/null @@ -1,7 +0,0 @@ -import { configDefaults, defineConfig } from "vitest/config"; - -export default defineConfig({ - test: { - exclude: [...configDefaults.exclude, "src/utils/FileBlob.spec.ts"], - }, -});