diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml new file mode 100644 index 00000000..5f5314c0 --- /dev/null +++ b/.github/workflows/changesets.yml @@ -0,0 +1,38 @@ +name: Changesets +on: + push: + branches: + - main +env: + CI: true + PNPM_CACHE_FOLDER: .pnpm-store +jobs: + version: + timeout-minutes: 15 + runs-on: ubuntu-latest + steps: + - name: checkout code repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: setup node.js + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: install pnpm + run: npm i pnpm@latest -g + - name: setup pnpm config + run: pnpm config set store-dir $PNPM_CACHE_FOLDER + - name: Setup npmrc + run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc + - name: install dependencies + run: pnpm install + - name: create and publish versions + uses: changesets/action@v1 + with: + version: pnpm ci:version + commit: "chore: update versions" + title: "chore: update versions" + publish: pnpm ci:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 29916f7c..0727f73d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,9 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'pnpm' + - name: Setup npmrc + run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc + - name: Install dependencies run: pnpm install diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index c41d6678..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Publish Packages - -on: - release: - types: [published] - -jobs: - publish: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20] - permissions: - packages: write - contents: read - env: - GH_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Set up Node.js ${{ matrix.node-version }} and Authenticate with GitHub Packages - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://npm.pkg.github.com' - always-auth: true - - - name: Replace GH_ACCESS_TOKEN in .npmrc - run: sed -i "s/\${GH_ACCESS_TOKEN}/${GH_ACCESS_TOKEN}/g" .npmrc - - - name: Install dependencies - run: pnpm install - - - name: Build packages - run: pnpm build - - - name: Publish packages - run: pnpm publish -r --access=restricted diff --git a/package.json b/package.json index a78a6a6e..b4df04ef 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "build:example": "pnpm --filter @tangled3/example-react build", "build:example-next": "pnpm --filter @tangled3/example-next build", "clean": "pnpm exec clean", + "ci:publish": "pnpm publish -r --access=restricted", "prepare": "husky && husky install", "lint": "eslint packages", "lint:fix": "eslint packages --fix",