Release v0.24.0 #145
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "*" | |
| jobs: | |
| publish-npm: | |
| name: Publish all packages to NPM | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| environment: | |
| name: production | |
| url: ${{ steps.gh-release.outputs.url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| cache: "yarn" | |
| - name: Setup Turbo | |
| id: setup | |
| run: | | |
| pkgNames=() | |
| pkgDirs=($(ls -d ./packages/*/)) | |
| for i in "${pkgDirs[@]}"; do | |
| dirname=$(basename "$i") | |
| if [[ "$dirname" == "core" ]]; then | |
| pkgNames+=("storybooker") | |
| else | |
| pkgNames+=("@storybooker/$dirname") | |
| fi | |
| done | |
| npx -y turbo prune ${pkgNames[@]} | |
| cp tsconfig.base.json out/tsconfig.base.json | |
| cp .oxlintrc.json out/.oxlintrc.json | |
| cp -R scripts out/scripts | |
| - name: Install dependencies | |
| working-directory: ./out | |
| run: yarn install --immutable | |
| - name: Verify | |
| working-directory: ./out | |
| run: npx turbo verify | |
| - name: Get Release data | |
| id: get_release_data | |
| if: github.ref_type == 'tag' | |
| run: | | |
| MESSAGE=$(git tag -l --format='%(contents)' "${GITHUB_REF_NAME}") | |
| echo "$MESSAGE" >> release-message.txt | |
| cat release-message.txt | |
| NPM_TAG="latest" | |
| if [[ $GITHUB_REF_NAME == *"-"* ]]; then | |
| echo "Working on a prerelease version..." | |
| TAG=$(echo "$GITHUB_REF_NAME" | cut -d'-' -f2 | cut -d'.' -f1) | |
| NPM_TAG=${TAG:-next} | |
| fi | |
| echo "NPM_TAG=${NPM_TAG}" | |
| echo "NPM_TAG=${NPM_TAG}" >> $GITHUB_ENV | |
| env: | |
| GITHUB_REF_NAME: ${{ github.ref_name }} | |
| - name: Publish on NPM | |
| working-directory: ./out | |
| run: | | |
| echo "Publishing with tag: $NPM_TAG" | |
| yarn workspaces foreach -A --no-private npm publish --tolerate-republish --provenance --access public --tag ${NPM_TAG:-latest} | |
| - name: Create GitHub Release | |
| if: github.ref_type == 'tag' | |
| id: gh-release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: release-message.txt | |
| make_latest: ${{ steps.get_release_data.outputs.NPM_TAG == 'latest' }} | |
| publish-jsr: | |
| name: Publish all packages to JSR | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| cache: "yarn" | |
| - name: Setup Turbo | |
| id: setup | |
| run: | | |
| npx -y turbo prune storybooker | |
| node scripts/prune-jsr-pkg-json.ts ./out/package.json | |
| cp tsconfig.base.json out/tsconfig.base.json | |
| cp .oxlintrc.json out/.oxlintrc.json | |
| cp -R scripts out/scripts | |
| - name: Install dependencies | |
| working-directory: ./out | |
| run: yarn install --immutable | |
| - name: Verify | |
| working-directory: ./out | |
| run: npx turbo verify | |
| - name: Publish on JSR - Core | |
| working-directory: ./out/packages/core | |
| run: npx -y jsr publish --allow-slow-types --allow-dirty --token ${{ secrets.JSR_API_TOKEN }} |