Publish release @vkontakte/vkui-floating-ui patch (tag legacy): Deploy • master • 10992987227 #31
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: Deploy (⚠️ use manually call only if necessary)' | |
# Note: display_title не задокументирован из-за чего в IDE может подчёркиваться строка | |
run-name: "${{ github.event_name == 'workflow_run' && format('{0}: Deploy • {1} • {2}', github.event.workflow_run.display_title, github.event.workflow_run.head_branch, github.event.workflow_run.id) || format('Publish {0} {1}@{2}: Deploy (⚠️ manually run)', inputs.publish_type, inputs.package_name, inputs.next_version) }}" | |
on: | |
workflow_run: | |
workflows: ['Publish pre-release', 'Publish release'] | |
types: [completed] | |
# Note: только на случай, если потребуется ручной запуск | |
workflow_dispatch: | |
inputs: | |
package_name: | |
description: "package's name:" | |
required: true | |
type: choice | |
options: | |
- '@vkontakte/vkui' | |
next_version: | |
description: "package's version (without 'v'):" | |
required: true | |
type: string | |
publish_type: | |
description: "⚠️ before change to 'release' make sure this is the case" | |
default: 'pre-release' | |
type: choice | |
options: | |
- 'release' | |
- 'pre-release' | |
env: | |
CHECKOUT_BRANCH: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.ref }} | |
jobs: | |
payload: | |
name: Prepare payload data | |
runs-on: ubuntu-latest | |
outputs: | |
package_name: ${{ steps.publish_workflow_payload.outputs.package_name || inputs.package_name }} | |
next_version: ${{ steps.publish_workflow_payload.outputs.next_version || inputs.next_version }} | |
is_for_prerelease: ${{ contains(github.event.workflow_run.name, 'Publish pre-release') || contains(inputs.publish_type, 'pre-release') }} | |
steps: | |
- name: Download artifact (if it is 'workflow_run') | |
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.event == 'workflow_dispatch' && github.event.workflow_run.conclusion == 'success' }} | |
id: artifact | |
uses: actions/download-artifact@v4 | |
with: | |
github-token: ${{ secrets.DEVTOOLS_GITHUB_TOKEN }} | |
name: publish_workflow_payload | |
path: publish_workflow_payload/ | |
run-id: ${{ github.event.workflow_run.id }} | |
- name: Parse artifact | |
if: ${{ steps.artifact.conclusion == 'success' }} | |
id: publish_workflow_payload | |
run: | | |
echo "package_name=$(cat publish_workflow_payload/package_name.txt)" >> $GITHUB_OUTPUT | |
echo "next_version=$(cat publish_workflow_payload/next_version.txt)" >> $GITHUB_OUTPUT | |
deploy_vkui_docs: | |
needs: [payload] | |
if: ${{ success() && needs.payload.outputs.package_name == '@vkontakte/vkui' && needs.payload.outputs.next_version }} | |
runs-on: ubuntu-latest | |
name: Deploy @vkontakte/vkui docs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.CHECKOUT_BRANCH }} | |
- name: Setting up the repository environment | |
uses: ./.github/actions/setup | |
- name: Creating docs for pre-release | |
if: ${{ fromJSON(needs.payload.outputs.is_for_prerelease) == true }} | |
run: | | |
yarn run docs:styleguide:build --dist dist/${{ needs.payload.outputs.next_version }} | |
yarn run docs:storybook:build -o ../../styleguide/dist/${{ needs.payload.outputs.next_version }}/playground | |
- name: Creating docs for release | |
if: ${{ fromJSON(needs.payload.outputs.is_for_prerelease) != true }} | |
run: | | |
yarn run docs:styleguide:build --dist dist | |
yarn run docs:storybook:build -o ../../styleguide/dist/playground | |
mkdir -p styleguide/${{ needs.payload.outputs.next_version }} | |
cp -R styleguide/dist/* styleguide/${{ needs.payload.outputs.next_version }} | |
mv styleguide/${{ needs.payload.outputs.next_version }} styleguide/dist | |
- 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 |