Release Stencil Storybook Plugin #30
This file contains hidden or 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: Release Stencil Storybook Plugin | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseType: | |
description: "Release type - major, minor or patch" | |
required: true | |
type: choice | |
default: "patch" | |
options: | |
- patch | |
- minor | |
- major | |
devRelease: | |
description: Set to "yes" to release a dev build | |
required: true | |
type: choice | |
default: "no" | |
options: | |
- "yes" | |
- "no" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: 🏗️ Setup and Build | |
uses: ./.github/actions/build | |
- name: 📦 Upload Build Artifacts | |
uses: stenciljs/.github/actions/upload-archive@main | |
with: | |
paths: packages/plugin/dist | |
get_dev_version: | |
if: inputs.devRelease == 'yes' | |
name: Get Dev Build Version | |
runs-on: ubuntu-latest | |
outputs: | |
dev-version: ${{ steps.generate-dev-version.outputs.DEV_VERSION }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Generate Dev Version | |
id: generate-dev-version | |
working-directory: packages/plugin | |
run: | | |
PKG_JSON_VERSION=$(cat package.json | jq -r '.version') | |
GIT_HASH=$(git rev-parse --short HEAD) | |
# A unique string to publish Stencil Storybook Plugin under | |
# e.g. "2.1.0-dev.1677185104.7c87e34" | |
DEV_VERSION=$PKG_JSON_VERSION-dev.$(date +"%s").$GIT_HASH | |
echo "Using version $DEV_VERSION" | |
# store a key/value pair in GITHUB_OUTPUT | |
# e.g. "DEV_VERSION=2.1.0-dev.1677185104.7c87e34" | |
echo "DEV_VERSION=$DEV_VERSION" >> $GITHUB_OUTPUT | |
shell: bash | |
release_storybook_stencil: | |
if: inputs.devRelease == 'yes' | |
name: Publish Dev Build | |
needs: [build, get_dev_version] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Download Build Archive | |
uses: stenciljs/.github/actions/download-archive@main | |
with: | |
path: packages/plugin | |
- name: Publish NPM | |
uses: stenciljs/.github/actions/publish-npm@main | |
with: | |
tag: dev | |
working-directory: packages/plugin | |
version: ${{ needs.get_dev_version.outputs.dev-version }} | |
token: ${{ secrets.NPM_PAT_STENCIL_BOT }} | |
release_create_stencil_cli: | |
if: inputs.devRelease == 'no' | |
name: Publish Stencil Storybook Plugin | |
needs: [build] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Download Build Archive | |
uses: stenciljs/.github/actions/download-archive@main | |
with: | |
path: packages/plugin | |
- uses: stenciljs/.github/actions/publish-npm@main | |
with: | |
tag: latest | |
working-directory: packages/plugin | |
skip-setup: "yes" | |
version: ${{ inputs.releaseType }} | |
token: ${{ secrets.NPM_PAT_STENCIL_BOT }} | |
github-token: ${{ secrets.GH_ADMIN_PAT }} |