Skip to content

Commit f50b673

Browse files
authored
chore: update workflows (#2130)
1 parent 11046e7 commit f50b673

File tree

6 files changed

+114
-13
lines changed

6 files changed

+114
-13
lines changed

.changeset/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
33
"changelog": false,
44
"commit": false,
5+
"fixed": [["@react-spring/*"]],
56
"linked": [],
67
"access": "public",
78
"baseBranch": "main",

.github/workflows/bundle-size.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,35 @@ on:
77

88
jobs:
99
size:
10+
name: 'Bundle Size'
11+
if: github.repository == 'pmndrs/react-spring'
1012
runs-on: ubuntu-latest
11-
1213
steps:
1314
- name: Checkout repo
1415
uses: actions/checkout@v3
1516

16-
- name: Setup node
17-
uses: actions/setup-node@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
21+
- name: Get yarn cache directory path
22+
id: yarn-cache-dir
23+
run: echo "::set-output name=dir::$(yarn cache dir)"
24+
25+
- name: Restore yarn cache
26+
uses: actions/cache@v3
27+
id: yarn-cache
1828
with:
19-
node-version: 16
29+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
30+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-yarn-
2033
2134
- name: Install
22-
run: yarn install
35+
run: yarn install --immutable
2336

2437
- name: Build packages
25-
run: yarn build
38+
run: yarn build --filter=!@react-spring/doc
2639

2740
- uses: preactjs/compressed-size-action@v2
2841
with:

.github/workflows/experimental.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ on:
44
workflow_dispatch:
55

66
jobs:
7-
release:
8-
name: 'Release'
7+
experimental:
8+
name: 'Experimental Release'
9+
if: github.repository == 'pmndrs/react-spring'
910
runs-on: ubuntu-latest
1011
steps:
1112
- name: Cancel Previous Runs
@@ -36,10 +37,10 @@ jobs:
3637
${{ runner.os }}-yarn-
3738
3839
- name: Install
39-
run: yarn install
40+
run: yarn install --immutable
4041

41-
- name: Install
42-
run: yarn build
42+
- name: Build
43+
run: yarn build --filter=!@react-spring/doc
4344

4445
- run: ./scripts/version-and-publish.sh
4546
env:

.github/workflows/nightly.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: 'Nightly Releases'
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * *'
6+
7+
jobs:
8+
nightly:
9+
name: 'Nightly Release'
10+
if: github.repository == 'pmndrs/react-spring'
11+
runs-on: ubuntu-latest
12+
outputs:
13+
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
14+
steps:
15+
- name: Cancel Previous Runs
16+
uses: styfle/[email protected]
17+
with:
18+
access_token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- uses: actions/checkout@v3
21+
22+
- name: Check for changes
23+
id: version
24+
run: |
25+
# get latest commit sha
26+
SHA=$(git rev-parse HEAD)
27+
# get first 7 characters of sha
28+
SHORT_SHA=${SHA::7}
29+
# get latest nightly tag
30+
LATEST_NIGHTLY_TAG=$(git tag -l v0.0.0-nightly-\* --sort=-creatordate | head -n 1)
31+
# check if last commit to main would be the nightly tag we're about to create (minus the date)
32+
# if it is, we'll skip the nightly creation
33+
# if not, we'll create a new nightly tag
34+
if [[ ${LATEST_NIGHTLY_TAG} == v0.0.0-nightly-${SHORT_SHA}-* ]]; then
35+
echo "🛑 Latest nightly tag is the same as the latest commit sha, skipping nightly release"
36+
else
37+
# v0.0.0-nightly-<short sha>-<date>
38+
NEXT_VERSION=nightly-${SHORT_SHA}
39+
# set output so it can be used in other jobs
40+
echo "NEXT_VERSION=${NEXT_VERSION}" >> $GITHUB_OUTPUT
41+
fi
42+
43+
- uses: actions/setup-node@v3
44+
if: steps.version.outputs.NEXT_VERSION
45+
with:
46+
node-version: 18
47+
48+
- name: Get yarn cache directory path
49+
if: steps.version.outputs.NEXT_VERSION
50+
id: yarn-cache-dir
51+
run: echo "::set-output name=dir::$(yarn cache dir)"
52+
53+
- name: Restore yarn cache
54+
uses: actions/cache@v3
55+
if: steps.version.outputs.NEXT_VERSION
56+
id: yarn-cache
57+
with:
58+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
59+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
60+
restore-keys: |
61+
${{ runner.os }}-yarn-
62+
63+
- name: Install
64+
if: steps.version.outputs.NEXT_VERSION
65+
run: yarn install --immutable
66+
67+
- name: Build
68+
if: steps.version.outputs.NEXT_VERSION
69+
run: yarn build --filter=!@react-spring/docs
70+
71+
- name: Setup npmrc
72+
if: steps.version.outputs.NEXT_VERSION
73+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
74+
75+
- run: ./scripts/version-and-publish.sh
76+
if: steps.version.outputs.NEXT_VERSION
77+
env:
78+
VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
79+
WITH_TAG: true
80+
DIST_TAG: nightly

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"test:cov": "jest --coverage",
4747
"test:ts": "tsc --noEmit",
4848
"test:e2e": "start-server-and-test 'yarn vite serve packages/parallax/test --host' http-get://localhost:3000 'yarn cypress run'",
49-
"release": "yarn test:ts && yarn test:unit && yarn build && yarn changeset publish",
49+
"release": "yarn test:ts && yarn test:unit && yarn build && yarn changeset publish --no-git-tag",
5050
"vers": "yarn changeset version"
5151
},
5252
"commitlint": {

scripts/version-and-publish.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set -e
77

88
version=$VERSION
99
distTag=$DIST_TAG
10+
withTag=$WITH_TAG
1011

1112
if [[ -z "$version" ]]; then
1213
echo "Please enter the version you want to publish"
@@ -20,4 +21,9 @@ fi
2021

2122
# publish packages
2223
./node_modules/.bin/changeset version --snapshot "$version"
23-
./node_modules/.bin/changeset publish --no-git-tag --snapshot --tag "$distTag"
24+
25+
if [[ "$withTag" == "true" ]]; then
26+
./node_modules/.bin/changeset publish --snapshot --tag "$distTag"
27+
else
28+
./node_modules/.bin/changeset publish --no-git-tag --snapshot --tag "$distTag"
29+
fi

0 commit comments

Comments
 (0)