Skip to content

Merge pull request #106 from hatena/eqeqeq #100

Merge pull request #106 from hatena/eqeqeq

Merge pull request #106 from hatena/eqeqeq #100

Workflow file for this run

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@v3
with:
version: 8
- 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'