Publish @vkontakte/icons minor #94
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 icons' | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
description: 'icons version type. Choose empty option if using custom version' | |
type: choice | |
default: 'minor' | |
options: | |
- patch | |
- minor | |
- major | |
- prerelease | |
- prepatch | |
- preminor | |
- premajor | |
- ~ | |
required: true | |
custom_version: | |
description: 'custom version: x.y.z-preid.a (without "v"). Overrides version type' | |
required: false | |
tag: | |
description: 'prerelease tag: preid ("alpha" or "beta"). Leave empty for release' | |
required: false | |
run-name: Publish @vkontakte/icons ${{ inputs.custom_version }} ${{ inputs.type }} ${{ inputs.tag }} | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./packages/icons | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'yarn' | |
always-auth: true | |
registry-url: 'https://registry.npmjs.org' | |
- run: YARN_ENABLE_SCRIPTS=false yarn install --immutable | |
# Required step for @vkontakte/icons as it is based on @vkontakte/icons-sprite | |
- name: Build @vkontakte/icons-sprite | |
run: yarn workspace @vkontakte/icons-sprite run build | |
- name: Build @vkontakte/icons | |
run: yarn icons-build | |
- 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 node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
- name: Bumping @vkontakte/icons version via version type | |
if: ${{ !github.event.inputs.custom_version }} | |
run: | | |
yarn run g:npm:version ${{ github.event.inputs.type }} --preid ${{ github.event.inputs.tag }} | |
- name: Bumping @vkontakte/icons version via custom version | |
if: ${{ github.event.inputs.custom_version }} | |
run: | | |
yarn 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 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/icons): from ${{ steps.prev_version.outputs.version }} to ${{ steps.updated_version.outputs.version }}' | |
git tag @vkontakte/icons@${{ 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: Setup NPM Auth Token to .yarnrc.yml | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_TOKEN }} | |
shell: bash | |
run: | | |
yarn config set npmAlwaysAuth true | |
yarn config set npmAuthToken $NODE_AUTH_TOKEN | |
- name: Publishing tagged release | |
if: ${{ github.event.inputs.tag }} | |
run: | | |
yarn npm publish --tag ${{ github.event.inputs.tag }} | |
- name: Publishing release | |
if: ${{ !github.event.inputs.tag }} | |
run: | | |
yarn npm publish | |
- name: Creating doc | |
run: yarn docs | |
- name: Publishing doc | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: packages/icons/docs | |
clean: false | |
force: false |