Skip to content
Merged

Dev #116

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# This workflow will run tests using node and then publish a package to npm when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
# This workflow will build and publish a package to npm when a release is created
# For more information see: https://docs.npmjs.com/trusted-publishers

name: npm publish

on:
release:
types: [published]

permissions:
id-token: write
contents: read

env:
TAG: '${{ github.event.release.tag_name }}'

Expand All @@ -15,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Validate version tag pattern
run: |
if [[ ! "${{ env.TAG }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
Expand All @@ -41,31 +45,29 @@ jobs:
runs-on: ubuntu-latest
needs: validate-release
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org/
cache: 'npm'
- run: npm ci
- run: npm run eslint
- run: npm test
- run: npm run test

build-and-publish:
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org/
cache: 'npm'
- run: npm install -g npm
- name: Update npm
run: npm install -g npm@latest
- run: npm ci
- run: npm run build
- name: Publish package
run: npm publish --provenance --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_SECRET }}
run: npm publish --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Add to Calendar Button React Wrapper](https://github.com/add2cal/add-to-calendar-button-react/blob/main/assets/readme-header.png?raw=true)

![Version](https://img.shields.io/npm/v/add-to-calendar-button-react?style=for-the-badge&label=Version)
[![Parent Script Version](https://img.shields.io/badge/Parent%20Script%20Version-v2.12.12-blue?style=for-the-badge)](https://github.com/add2cal/add-to-calendar-button)
[![Parent Script Version](https://img.shields.io/badge/Parent%20Script%20Version-v2.12.13-blue?style=for-the-badge)](https://github.com/add2cal/add-to-calendar-button)
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/add-to-calendar-button-react?style=for-the-badge)](https://www.npmjs.com/package/add-to-calendar-button-react)
[![npm Installations](https://img.shields.io/npm/dt/add-to-calendar-button-react?label=npm%20Installations&style=for-the-badge)](https://www.npmjs.com/package/add-to-calendar-button-react)

Expand Down
Loading
Loading