diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a39c3ba --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,74 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Publish Node.js Package + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18] + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8.6.2 + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + registry-url: 'https://npm.pkg.github.com' + scope: '@saitamau-maximum' + always-auth: true + + - name: Install dependencies + run: pnpm install --frozen-lockfile --prefer-offline + + - name: Test + run: pnpm format:check && pnpm lint && pnpm build + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 8.6.2 + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + registry-url: 'https://npm.pkg.github.com' + scope: '@saitamau-maximum' + always-auth: true + + - name: Install dependencies + run: pnpm install --frozen-lockfile --prefer-offline + + - name: Build + run: pnpm build + + - name: Publish to GitHub Packages + run: pnpm publish + working-directory: packages/components + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/README.md b/README.md index b0e0831..9c143bf 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,9 @@ FontをHeadで読み込んでください、推奨は`Noto Sans JP`です。 ``` + +Package のインストールをするには、 `~/.npmrc` に以下を追加してください。 + +```npmrc +@saitamau-maximum:registry=https://npm.pkg.github.com +``` diff --git a/packages/components/package.json b/packages/components/package.json index 0d89fc9..66638e0 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,5 +1,5 @@ { - "name": "maximum-ui", + "name": "@saitamau-maximum/ui", "version": "0.0.0", "type": "module", "sideEffects": false,