diff --git a/.changeset/config.json b/.changeset/config.json index 11452a014f..a86ee57174 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -2,6 +2,7 @@ "$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json", "changelog": false, "commit": false, + "fixed": [["@react-spring/*"]], "linked": [], "access": "public", "baseBranch": "main", diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml index 9270ef04e1..8b6b461be0 100644 --- a/.github/workflows/bundle-size.yml +++ b/.github/workflows/bundle-size.yml @@ -7,22 +7,35 @@ on: jobs: size: + name: 'Bundle Size' + if: github.repository == 'pmndrs/react-spring' runs-on: ubuntu-latest - steps: - name: Checkout repo uses: actions/checkout@v3 - - name: Setup node - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Get yarn cache directory path + id: yarn-cache-dir + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Restore yarn cache + uses: actions/cache@v3 + id: yarn-cache with: - node-version: 16 + path: ${{ steps.yarn-cache-dir.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Install - run: yarn install + run: yarn install --immutable - name: Build packages - run: yarn build + run: yarn build --filter=!@react-spring/doc - uses: preactjs/compressed-size-action@v2 with: diff --git a/.github/workflows/experimental.yml b/.github/workflows/experimental.yml index d862d0de58..62a8239594 100644 --- a/.github/workflows/experimental.yml +++ b/.github/workflows/experimental.yml @@ -4,8 +4,9 @@ on: workflow_dispatch: jobs: - release: - name: 'Release' + experimental: + name: 'Experimental Release' + if: github.repository == 'pmndrs/react-spring' runs-on: ubuntu-latest steps: - name: Cancel Previous Runs @@ -36,10 +37,10 @@ jobs: ${{ runner.os }}-yarn- - name: Install - run: yarn install + run: yarn install --immutable - - name: Install - run: yarn build + - name: Build + run: yarn build --filter=!@react-spring/doc - run: ./scripts/version-and-publish.sh env: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000..44ea6b136f --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,80 @@ +name: 'Nightly Releases' + +on: + schedule: + - cron: '0 7 * * *' + +jobs: + nightly: + name: 'Nightly Release' + if: github.repository == 'pmndrs/react-spring' + runs-on: ubuntu-latest + outputs: + NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }} + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/checkout@v3 + + - name: Check for changes + id: version + run: | + # get latest commit sha + SHA=$(git rev-parse HEAD) + # get first 7 characters of sha + SHORT_SHA=${SHA::7} + # get latest nightly tag + LATEST_NIGHTLY_TAG=$(git tag -l v0.0.0-nightly-\* --sort=-creatordate | head -n 1) + # check if last commit to main would be the nightly tag we're about to create (minus the date) + # if it is, we'll skip the nightly creation + # if not, we'll create a new nightly tag + if [[ ${LATEST_NIGHTLY_TAG} == v0.0.0-nightly-${SHORT_SHA}-* ]]; then + echo "🛑 Latest nightly tag is the same as the latest commit sha, skipping nightly release" + else + # v0.0.0-nightly-- + NEXT_VERSION=nightly-${SHORT_SHA} + # set output so it can be used in other jobs + echo "NEXT_VERSION=${NEXT_VERSION}" >> $GITHUB_OUTPUT + fi + + - uses: actions/setup-node@v3 + if: steps.version.outputs.NEXT_VERSION + with: + node-version: 18 + + - name: Get yarn cache directory path + if: steps.version.outputs.NEXT_VERSION + id: yarn-cache-dir + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Restore yarn cache + uses: actions/cache@v3 + if: steps.version.outputs.NEXT_VERSION + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install + if: steps.version.outputs.NEXT_VERSION + run: yarn install --immutable + + - name: Build + if: steps.version.outputs.NEXT_VERSION + run: yarn build --filter=!@react-spring/docs + + - name: Setup npmrc + if: steps.version.outputs.NEXT_VERSION + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc + + - run: ./scripts/version-and-publish.sh + if: steps.version.outputs.NEXT_VERSION + env: + VERSION: ${{ steps.version.outputs.NEXT_VERSION }} + WITH_TAG: true + DIST_TAG: nightly diff --git a/package.json b/package.json index 0278ddfaf3..36d1eff47d 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:cov": "jest --coverage", "test:ts": "tsc --noEmit", "test:e2e": "start-server-and-test 'yarn vite serve packages/parallax/test --host' http-get://localhost:3000 'yarn cypress run'", - "release": "yarn test:ts && yarn test:unit && yarn build && yarn changeset publish", + "release": "yarn test:ts && yarn test:unit && yarn build && yarn changeset publish --no-git-tag", "vers": "yarn changeset version" }, "commitlint": { diff --git a/scripts/version-and-publish.sh b/scripts/version-and-publish.sh index 4f385b7df2..9b6a180c64 100755 --- a/scripts/version-and-publish.sh +++ b/scripts/version-and-publish.sh @@ -7,6 +7,7 @@ set -e version=$VERSION distTag=$DIST_TAG +withTag=$WITH_TAG if [[ -z "$version" ]]; then echo "Please enter the version you want to publish" @@ -20,4 +21,9 @@ fi # publish packages ./node_modules/.bin/changeset version --snapshot "$version" -./node_modules/.bin/changeset publish --no-git-tag --snapshot --tag "$distTag" + +if [[ "$withTag" == "true" ]]; then + ./node_modules/.bin/changeset publish --snapshot --tag "$distTag" +else + ./node_modules/.bin/changeset publish --no-git-tag --snapshot --tag "$distTag" +fi