Skip to content

Commit

Permalink
feat: add experimental release script
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis committed Feb 25, 2023
1 parent 0ac469e commit d672c20
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Experimental Releases'

on:
workflow_dispatch:

jobs:
release:
name: 'Release'
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3

- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- 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:
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: ./scripts/version-and-publish.sh
env:
VERSION: '${{ github.sha }}'
DIST_TAG: experimental
26 changes: 26 additions & 0 deletions scripts/version-and-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Force start from root folder
cd "$(dirname "$0")/.."

set -e

version=$VERSION
distTag=$DIST_TAG

if [[ -z "$version" ]]; then
echo "Please enter the version you want to publish"
read -r version
fi

if [[ -z "$distTag" ]]; then
echo "Please enter the dist-tag you want to publish with"
read -r distTag
fi


echo "$version"

# publish packages
./node_modules/.bin/changeset version --snapshot "$version"
./node_modules/.bin/changeset publish --no-git-tag --snapshot --tag "$distTag"

0 comments on commit d672c20

Please sign in to comment.