Merge pull request #144 from hatena/improve-eslint-plugin-import-usage-2 #140
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 | |
env: | |
CI: true | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '!*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'pnpm' | |
always-auth: true | |
registry-url: https://npm.pkg.github.com | |
scope: '@hatena' | |
- run: pnpm install | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# まだ publish されていないバージョンなら publish する | |
- name: publish package | |
run: | | |
npx can-npm-publish --verbose && pnpm publish || echo "Does not publish" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# package.json からバージョンを取得する | |
- name: get version from package.json | |
id: package-version | |
run: echo "version=$(cat package.json | jq -r .version)" >> $GITHUB_OUTPUT | |
# まだ tag がないバージョンなら tag を push する | |
- name: publish tag | |
uses: pkgdeps/git-tag-action@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
github_repo: ${{ github.repository }} | |
git_commit_sha: ${{ github.sha }} | |
version: ${{ steps.package-version.outputs.version }} | |
git_tag_prefix: 'v' |