-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
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: | | ||
OUTPUT=$(pnpm release:package -l ${{ inputs.releaseLevel }} ${{ steps.pre.outputs.pre }}) | ||
LAST_LINE=$(echo "$OUTPUT" | tail -n 1) | ||
echo "branchName=$LAST_LINE" >> $GITHUB_OUTPUT | ||
shell: bash | ||
|
||
- name: Create PR | ||
id: create-pr | ||
run: | | ||
gh pr create \ | ||
-B main \ | ||
-t ":bookmark: Update package.json" \ | ||
-a "${{ github.actor }}" \ | ||
-F ./.github/workflows/PR_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') }} |
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