Publish Package + Create Release #62
Workflow file for this run
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 Package + Create Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
- 'create-monkey*' | |
jobs: | |
publish_release: | |
# prevents this action from running on forks | |
if: github.repository == 'lisonge/vite-plugin-monkey' | |
runs-on: ubuntu-latest | |
environment: Release | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: volta-cli/action@v3 | |
- uses: pnpm/action-setup@v2 | |
- run: pnpm install | |
- run: pnpm build | |
- name: Publish package | |
run: | | |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
pnpm run ci-publish ${{ github.ref_name }} | |
- name: Get pkgName for tag | |
id: tag | |
run: | | |
# matching v2.0.0 / v2.0.0-beta.8 etc | |
if [[ $GITHUB_REF_NAME =~ ^v.+ ]]; then | |
pkgName="vite-plugin-monkey" | |
else | |
# `%@*` truncates @ and version number from the right side. | |
# https://stackoverflow.com/questions/9532654/expression-after-last-specific-character | |
pkgName=${GITHUB_REF_NAME%@*} | |
fi | |
echo "::set-output name=pkgName::$pkgName" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body: | | |
Please refer to [CHANGELOG.md](https://github.com/lisonge/vite-plugin-monkey/blob/${{ github.ref_name }}/packages/${{ steps.tag.outputs.pkgName }}/CHANGELOG.md) for details. |