Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update workflows #2130

Merged
merged 7 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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-<short sha>-<date>
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 7 additions & 1 deletion scripts/version-and-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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