diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4a29858..4b4d59e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,5 +19,5 @@ jobs: version: 8 - run: pnpm install - run: pnpm lint - - run: pnpm build - run: pnpm test + - run: pnpm build diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fb2e410..167a155 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -30,8 +30,8 @@ jobs: - name: Run lint run: pnpm lint - - name: Build package - run: pnpm build - - name: Run tests run: pnpm test + + - name: Build package + run: pnpm build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db26f4f..b8dc0a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: Release & Publish on: push: @@ -8,15 +8,19 @@ on: jobs: release: runs-on: ubuntu-latest + permissions: + contents: write # push tags & create releases + packages: write # publish to npm + steps: - name: Checkout code uses: actions/checkout@v3 - - name: Setup Node.js + - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: 20 - registry-url: https://registry.npmjs.org/ + node-version: "20" + registry-url: "https://registry.npmjs.org" - name: Setup pnpm uses: pnpm/action-setup@v2 @@ -29,8 +33,29 @@ jobs: - name: Build package run: pnpm build - - name: Automated Release - uses: semantic-release/semantic-release@v24 + - name: Get package version + id: get_version + run: | + echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV + + - name: Push Git tag + run: | + git tag v${{ env.VERSION }} + git push origin v${{ env.VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub Release + uses: actions/create-release@v1 + with: + tag_name: v${{ env.VERSION }} + release_name: Release v${{ env.VERSION }} + draft: false + prerelease: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish to npm + run: pnpm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 887f011..107fa53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-textify", - "version": "0.1.0", + "version": "0.1.1", "description": "Convert html to plain text", "main": "dist/index.js", "module": "dist/index.mjs",