fix lint warn #316
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: Release | |
on: | |
release: | |
types: ["created"] | |
push: | |
jobs: | |
ci: | |
uses: "./.github/workflows/ci.yml" | |
secrets: inherit | |
build-release: | |
runs-on: "ubuntu-latest" | |
needs: ["ci"] | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: "https://registry.npmjs.org" | |
cache: pnpm | |
- name: Install deps | |
run: pnpm i --frozen-lockfile | |
- name: Build | |
run: pnpm build | |
- name: publish | |
run: | | |
if [ "${{ github.event_name }}" == "release" ]; then | |
# This is a release, publish without a tag | |
npm publish --provenance --access public | |
else | |
branch="${{ github.ref_name }}" | |
tmp=$(mktemp) | |
short_sha=$(echo "${{ github.sha }}" | cut -c 1-32) | |
# skip tag push events | |
if [[ $branch == *v* && $branch == *.* ]]; then | |
exit 0 | |
fi | |
jq --arg x "-$short_sha" '.version += $x' package.json > "$tmp" && mv "$tmp" package.json | |
if [ $branch != "master" ]; then | |
# This is not the master branch, publish with the branch name as a tag | |
npm publish --provenance --access public --tag "dev-$branch" | |
fi | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |