Skip to content

Publish pre-release prerelease (tag beta) #12

Publish pre-release prerelease (tag beta)

Publish pre-release prerelease (tag beta) #12

name: 'Publish @vkontakte/vkui (pre-release)'
on:
workflow_dispatch:
inputs:
type:
description: 'version type (prerelease for bumping pre-release version):'
required: true
type: choice
default: 'prerelease'
options:
- prepatch
- preminor
- premajor
- prerelease
tag:
required: true
description: 'tag ("beta" or "alpha"):'
type: choice
default: 'beta'
options:
- beta
- alpha
custom_version:
description: 'custom version: x.y.z-beta.0 (without "v")'
required: false
run-name: Publish pre-release ${{ inputs.type }} ${{ inputs.custom_version }} (tag ${{ inputs.tag }})
jobs:
publish:
concurrency: ci-gh-pages
outputs:
release_tag: ${{ steps.updated_version.outputs.version }}
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }}
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
always-auth: true
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: YARN_ENABLE_SCRIPTS=false yarn install --immutable
- name: Run linters
run: yarn run lint
- name: Run @vkontakte/vkui unit tests
run: yarn workspace @vkontakte/vkui run test
- name: Set Git credentials
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Saving current version to env
id: prev_version
run: |
echo "version=$(yarn workspace @vkontakte/vkui node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Bump by version type
if: ${{ !github.event.inputs.custom_version }}
run: yarn workspace @vkontakte/vkui run g:npm:version ${{ github.event.inputs.type }} --preid ${{ github.event.inputs.tag }}
- name: Bump by custom version
if: ${{ github.event.inputs.custom_version }}
run: yarn workspace @vkontakte/vkui run g:npm:version ${{ github.event.inputs.custom_version }} --preid ${{ github.event.inputs.tag }}
- name: Saving updated version to env
id: updated_version
run: |
echo "version=$(yarn workspace @vkontakte/vkui node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Adding commit and tag with updated version number
run: |
git add -A
git commit -m 'bump(@vkontakte/vkui): from ${{ steps.prev_version.outputs.version }} to ${{ steps.updated_version.outputs.version }}'
git tag v${{ steps.updated_version.outputs.version }}
- name: Pushing changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
- name: Generate archive
working-directory: ./packages/vkui
run: yarn pack
- name: Publishing release
working-directory: ./packages/vkui
run: |
npm publish package.tgz --tag ${{ github.event.inputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }}
- name: Build styleguide
run: yarn run docs:styleguide:build --dist dist/${{ steps.updated_version.outputs.version }}
- name: Build storybook
run: yarn docs:storybook:build -o ../../styleguide/dist/${{ steps.updated_version.outputs.version }}/playground
- name: Publishing doc
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }}
branch: gh-pages
folder: styleguide/dist
clean: false
force: false