Publish minor #179
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
name: 'Publish @vkontakte/vkui' | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
description: 'version type:' | |
required: true | |
type: choice | |
default: 'minor' | |
options: | |
- patch | |
- minor | |
- major | |
custom_version: | |
description: 'custom version: x.y.z (without "v")' | |
required: false | |
run-name: Publish ${{ inputs.type }} ${{ inputs.custom_version }} | |
jobs: | |
publish: | |
concurrency: ci-gh-pages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
always-auth: true | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile --ignore-scripts | |
- name: Set Git credentials | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Bump by version type | |
if: ${{ !github.event.inputs.custom_version }} | |
run: yarn workspace @vkontakte/vkui version --${{ github.event.inputs.type }} --no-commit-hooks | |
- name: Bump by custom version | |
if: ${{ github.event.inputs.custom_version }} | |
run: yarn workspace @vkontakte/vkui version --new-version ${{ github.event.inputs.custom_version }} --no-commit-hooks | |
- name: Run linters | |
run: yarn run lint | |
- name: Run @vkontakte/vkui unit tests | |
run: yarn workspace @vkontakte/vkui run test | |
- name: Pushing changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Create stable branch | |
uses: VKCOM/gh-actions/VKUI/stable-branch@main | |
with: | |
token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
directory: packages/vkui/ | |
- name: Publishing release | |
run: yarn workspace @vkontakte/vkui publish --non-interactive | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }} | |
- name: Save updated package version to env | |
id: updated_version | |
run: echo "version=$(yarn workspace @vkontakte/vkui --silent run --silent package:version)" >> $GITHUB_OUTPUT | |
- name: Creating doc for stable release | |
run: | | |
yarn run docs:styleguide:build | |
yarn run docs:storybook:build | |
mkdir styleguide/${{ steps.updated_version.outputs.version }} styleguide/dist/playground | |
cp -R packages/vkui/storybook-static/* styleguide/dist/playground | |
cp -R styleguide/dist/* styleguide/${{ steps.updated_version.outputs.version }} | |
mv styleguide/${{ steps.updated_version.outputs.version }} styleguide/dist/${{ steps.updated_version.outputs.version }} | |
- 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 |