This repository has been archived by the owner on Apr 21, 2024. It is now read-only.
docs: archive repo (#136) #268
This file contains 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
# This workflow will ensure all PRs are labeled so we can later create releases | |
name: Prerelease | |
on: | |
- push | |
- workflow_dispatch | |
jobs: | |
prerelease: | |
if: "github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[prerelease]')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: npm ci | |
- name: Set up git credentials | |
run: | | |
git config --global user.name 'ci' | |
git config --global user.email '[email protected]' | |
- name: 'Wait for tests to succeed' | |
uses: fountainhead/[email protected] | |
if: success() | |
id: wait-for-tests | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
checkName: 'test' | |
ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
timeoutSeconds: 1200 | |
intervalSeconds: 20 | |
- name: 'Tests failed - exit' | |
if: steps.wait-for-tests.outputs.conclusion != 'success' | |
run: | | |
echo "::error::test check failed - prerelease cancelled" | |
exit 1 | |
- name: Create Updated version | |
id: create-update-version | |
if: success() | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
run: | | |
npm run pre-release | |
echo "package_version=$(node -e "console.log(require('./package.json').version)")" >> $GITHUB_OUTPUT | |
- name: Publish the new version to npm | |
if: success() | |
run: npm run build && npm publish --tag prerelease | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.npm_token }} | |
- uses: 'marvinpinto/action-automatic-releases@latest' | |
if: success() | |
with: | |
repo_token: '${{ secrets.GITHUB_TOKEN }}' | |
prerelease: true | |
automatic_release_tag: prerelease | |
- name: Get current PR id | |
uses: 8BitJonny/[email protected] | |
id: PR | |
if: success() | |
- name: Create comment with prerelease version details | |
if: success() | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{ steps.PR.outputs.number }} | |
body: | | |
A new prerelease version of this PR has been published: `${{ steps.create-update-version.outputs.package_version }}` | |
``` | |
// To install this prerelease version using npm, please run the following command in your terminal: | |
npm i vibe-storybook-components@${{ steps.create-update-version.outputs.package_version }} | |
// If you prefer using Yarn, you can use the following command instead: | |
yarn add vibe-storybook-components@${{ steps.create-update-version.outputs.package_version }} | |
``` |