Skip to content

Release preup version #7

Release preup version

Release preup version #7

name: Publish unplugin-lit sass
run-name: Release ${{ inputs.releaseLevel }} version
on:
workflow_dispatch:
inputs:
releaseLevel:
description: "Release level"
required: true
default: patch
type: choice
options:
- major
- minor
- patch
- preup
isPre:
description: "Is New pre-release (exp: X.X.X-beta.0)"
required: false
type: boolean
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
id-token: write
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=8192
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
registry-url: "https://registry.npmjs.org/"
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 9.1.0
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Node Dependencies
run: pnpm install --frozen-lockfile
- name: Set .npmrc
run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > packages/unplugin/.npmrc
- name: Set pre value
id: pre
run: |
if [[ "${{ inputs.isPre }}" == "true" ]]; then
echo "pre=--pre" >> $GITHUB_OUTPUT
else
echo "pre=" >> $GITHUB_OUTPUT
fi
- name: Release
id: release
run: |
pnpm p:release build && pnpm release:package -l ${{ inputs.releaseLevel }} ${{ steps.pre.outputs.pre }}
shell: bash
- name: Create PR
id: create-pr
run: |
gh pr create \
-B main \
-t ":bookmark: Update package.json" \
-a "${{ github.actor }}" \
-F ./.github/pull_request_template.md
create-github-release:
needs: release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
registry-url: "https://registry.npmjs.org/"
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 9.1.0
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Node Dependencies
run: pnpm install --frozen-lockfile
- name: Get Current package info
id: get-package-info
run: |
echo "PACKAGE_VERSION=$(pnpm view unplugin-lit-sass version)" >> $GITHUB_OUTPUT
- name: Create GitHub Release
id: create-release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: ${{ steps.get-package-info.outputs.PACKAGE_VERSION }}
prerelease: ${{ contains(steps.get-package-info.outputs.PACKAGE_VERSION, '-beta') }}