Skip to content

Commit

Permalink
chore: add publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
cyco130 committed Jul 10, 2023
1 parent fb623f0 commit ce0d8dd
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
version: 8

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
version: 8

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v3
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/e2e.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish to NPM

on:
workflow_dispatch:
inputs:
version:
description: "Version to publish"
required: true
type: "string"
commit:
description: "Should we commit the version bump?"
required: false
type: "boolean"
default: true

defaults:
run:
working-directory: .

jobs:
publish:
runs-on: ubuntu-latest
name: "Publish to NPM"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set node version to 18
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
cache: "pnpm"

- name: Install
run: pnpm install

- name: Set up git user
run: |
git config --global user.name "GitHub Action Bot"
git config --global user.email "<>"
- name: Bump version
run: "pnpm version ${{ github.event.inputs.version }} --no-git-tag-version"

- name: "Publish to NPM"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm -r publish --access public --no-git-checks

- name: "Commit version bump"
if: ${{ github.event.inputs.commit == 'true' }}
run: |
git status
git commit -am "release: ${{ github.event.inputs.version }}"
git push
git tag ${{ github.event.inputs.version }}
git push --tags

0 comments on commit ce0d8dd

Please sign in to comment.