Skip to content

Commit d672c20

Browse files
committed
feat: add experimental release script
1 parent 0ac469e commit d672c20

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/experimental.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 'Experimental Releases'
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
name: 'Release'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Cancel Previous Runs
12+
uses: styfle/[email protected]
13+
with:
14+
access_token: ${{ secrets.GITHUB_TOKEN }}
15+
16+
- uses: actions/checkout@v3
17+
18+
- name: Setup npmrc
19+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
20+
21+
- uses: actions/setup-node@v3
22+
with:
23+
node-version: 18
24+
25+
- name: Get yarn cache directory path
26+
id: yarn-cache-dir
27+
run: echo "::set-output name=dir::$(yarn cache dir)"
28+
29+
- name: Restore yarn cache
30+
uses: actions/cache@v3
31+
id: yarn-cache
32+
with:
33+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
34+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-yarn-
37+
38+
- name: Install
39+
run: yarn install
40+
41+
- run: ./scripts/version-and-publish.sh
42+
env:
43+
VERSION: '${{ github.sha }}'
44+
DIST_TAG: experimental

scripts/version-and-publish.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# Force start from root folder
4+
cd "$(dirname "$0")/.."
5+
6+
set -e
7+
8+
version=$VERSION
9+
distTag=$DIST_TAG
10+
11+
if [[ -z "$version" ]]; then
12+
echo "Please enter the version you want to publish"
13+
read -r version
14+
fi
15+
16+
if [[ -z "$distTag" ]]; then
17+
echo "Please enter the dist-tag you want to publish with"
18+
read -r distTag
19+
fi
20+
21+
22+
echo "$version"
23+
24+
# publish packages
25+
./node_modules/.bin/changeset version --snapshot "$version"
26+
./node_modules/.bin/changeset publish --no-git-tag --snapshot --tag "$distTag"

0 commit comments

Comments
 (0)